« first day (965 days earlier)      last day (4208 days later) » 
06:00 - 17:0017:00 - 00:00

06:28
hai
 
4 hours later…
10:00
cabbage ya'all
cabbage cabbage
cabbage
@JonClements I got 3k yesterday!
And it was exactly on the dot 3k!
Regex help pls anyone @JonClements <3
congrats
regex???! :)
I'm trying to match all tags with a certain class in BeautifulSoup
the class is 'excel' then a number
so 'excel24
'
I tried print table.findAll(attrs={'class': r'^excel\d+'}) But I suck at regex and that didn't work
Are they a single class?
<div class="excel24">...</div> for instance?
10:11
yes
Oh... you're not compiling it
re.compile('^excel\d+')
<33333333333
thin the default behaviour is to call .match for regex objects
10:53
okie dokies - off out - rhbrb (or whatever it is!)
11:45
anyone on?
hi
I got a quick question since I finally decided I am going to read a few books on python to really learn the language
Alright, keep in mind I'm not as experienced as other users on this website
I know you can name variables either way variableName variable_name but which is more preferred by the python community
Ah, you are looking for python.org/dev/peps/pep-0008
11:47
well kind of but no at the same time.
both styles are used, but I feel one style is more accepted than the other and just want some input on it
how do you name your variables
the second one
Leave the first one for functions
so you basically do this
    def functionName
        variable_name = ?
I actually like the way that looks now that I type it out
yup, that looks good
Don't forget the colon :)
class Classname()
def functionName:
    variable_name = ?
Yup!
or actually
Sorry
for functions, all lowercase
def myfunc:
return 'hi!'
11:53
def myfunction
    return('hi')
yep
got it, now as I read thinkPython I can write my code properly as I go through the examples
also do you prefer
#this function does somethign
def function

or
def function #this function does something
for comments
The second one
11:58
me to but shouldnt python code be no more than x characters in a line
79 characters
I believe the convention is to use docstrings on the line before the function name.
It does some magic on it, so then when you do help(myFunction), it shows whatever you wrote.
'''
comment
'''
def function
like so?
yeah
I guess I get why that would be common
being able to call help on it makes sense
what if its a basic function where the only comment you have on it is to remind yourself why its there
Oops. By "on the line before the function name", I mean, "on the line after the function name"
If you need a comment to remind yourself why the function exists, it sure would be helpful if that reminder appeared whenever you did help(myFunction) :-)
12:05
def function
'''
describes function
'''
that adds so many lines to the code though
def function
'''
print function
'''
print('hello world')
You can put the quotes on the same line as the comment if you want.
compared to
def function
print('hello world')
'''function description'''
like so?
No, the docstring should be the first thing in the function.
If it appears after the print statement, it won't think it's a docstring
well I know that I didn't mean for that to fall under print, just saying you can write docstrings like '''docstring'''
instead of
'''
docstring
'''
Yeah
12:09
alright thats a useful thing to know
thanks for the input, I gtg because I got yelled at the otherday for spending to much time on here while at work.
rhubarb
Bye
12:42
hi somebody here? I need help to install pip
I'm pretty sure that to install it, I just did sudo easy_install pip :-)
SCNR: Der Befehl "sudo" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
I'm using windows
export LANG=C ftw
(not that it will work on windows..)
indeet :)
I used python the last time 4 years ago
I tried to download pypi.python.org/pypi/setuptools#files but that installer is yelling that python was not found. surly a 32bit installer which does not find my 64 python installation
in general is it better to use a 32 or 64 bit edition of python 2.6?
> wget --no-check-certificate https://raw.github.com/pypa/pip/master/contrib/get-pip.py
> py get-pip.py
An error occured while trying to run get-pip.py. Make sure you have setuptools or distribute installed.
dammed
Have you considered upgrading? 2.6 is a couple versions behind.
12:58
hm py returns Python 2.7.3
okay it is a newer installation
Before install bootstrap.
Scanning installed packages
No setuptools distribution found
running install
error: C:\Program Files (x86)\Python27\lib\site-packages\win32com\gen_py\__init__.py: Permission denied
what does this mean? :(
You don't have permission :p
I could try a admin shell... god it is only 30 minutes until weekend :D
@Haidro thx success^^
13:14
I need to execute pip install awscli but pip cannot be found
13:42
Have you installed pip?
and ensured it's in the path?
Hey Guys,
I have a question about threading
Is it different if I use only a dict or the threading.local() to save data?
A dict would be accessible by other threads
14:00
ahh ok thanks
I just created a new tag ... But I often wonder if I should create a new tag.
Today I am trying to get Python to talk to Microsoft Access... It is not a user-friendly process.
Oooo Access - the world's best "database" :)
@mgilson I hope you remembered the wiki entry for it? :)
I added a very simple wiki entry for it.
The data within the file is small enough that I could theoretically copy-paste it by hand into a CSV or similar, in about 8 hours or so.
14:07
I had a question about them
Meaning, if I spend more than a day fiddling with drivers and whatnot, then I'm being less efficient than if I had done it manually.
(record-array is the tag)
err... sorry structured-array
(record array would be a possible synonym)
The problem is that it means something very specific in numpy, but I imagine it could be applied to other languages that have a similar data structure ...
e.g. a C array of struct.
@Kevin create a view and export that to CSV?
Not much of a view here. I see a brick wall, an alleyway, and rain.
Morning everybody
14:13
I see rain ... On a good day a train will roll past.
Ah, here's an export button. Didn't see that the first go-round.
What sort of methods do python programmers use to make a GUI? I only have experience with that in C++, Java, and obviously web stuff
I use Tkinter for simple stuff.
Buttons, drawing shapes, etc
if you have experience with C++ then you could use Qt
Thanks! I'll check those out
14:23
I use Tkinter for all my GUI needs ... Of course, that's probably because my GUI needs aren't all that substantial ...
It can do things like progress bars, prompts, and a console/log thing similar to like a browsers console?
I asked a bit above about the differences to save the data. in locals or in a dict
thread=threading.currentThread()
_data[thread]=data_to_save

What you think about to save the data like this?
    #proper python (Not a program)

    Class Classname #class names should always start with an upercase letter

        def functionName #function names should always start with a lower case letter and the second
    	              #word should be Uppercase

''' Docstrings are used right after function names to describe the function'''

    variable_name = #variable names should be lowercase with underscores seperating words

    #In python one line of code should not exceed 79 characters(including spaces)
does that look about right
wow that formatted horribly
meh, looks okay to me
Function names should be lowercase, with words separated by underscores as necessary to improve readability.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.
-- PEP 8
14:30
so
function_name instead of functionName
Almost without exception, class names use the CapWords convention.
so instead of ChannelTests, it would be channel_tests?
So prefer ClassName over Classname
#proper python code(not a code)
class ClassName
    def function_name
        '''describe function'''
        variable_name = something
Looks good to me.
14:32
got it than
seems to be missing a some :'s and ()'s but yeah ;)
Interesting, why is that the "correct" way of doing it in python as opposed to other languages?
I wanna make sure that I start practicing proper format from the getgo
@Inhale.Py -- It's also common to put your docstring in triple double quotes rather than triple single quotes.
Docstring?
14:34
It's only "correct" because that's how the PEP tells us it should be.
I hate holding down the shift key
I know it's not PEP 8, but ...
The main goal is consistency. If every python programmer agreed tomorrow that camelCase was good for functions, and they would go back and update all their underscore_style names, then that would be totally fine.
@ShannonStrutz -- the docstring is the bit '''describe fuction''' in Inhale's code above.
whats the more common way to define strings
print('string')
print("string")
14:35
Exactly, the reality is that is doesn't really matter what casing rules people use, but using the same stuff across the board makes everything easier.
(Frankly I would prefer camelCase, because my clumsy fingers can't find the underscore button easily)
@Inhale.Py Really doesn't matter - either.
Android... I can't believe it still fails at handling Content-Disposition headers properly.
if request.user_agent.platform == 'android':
    escaped_name = name.replace('\\', '\\\\').replace('"', '\\"')
    rv.headers.set('Content-Disposition', 'attachment; filename="%s"' % escaped_name)
@Kevin -- I agree, but it's also nice that the language has conventions that are pretty well established. That way, when I import x and import y, I don't have to have x.func_name and y.funcName in the same script.
Such a hack shouldn't be needed nowadays.. especially since the issue with unquoted content dispositions (or "inline" fwiw) was there 2y ago
14:36
Plus it's useful to be able to spot class names at a glance.
@mgilson Yes, although is that anything similar to like javadocs? Does it enable some sort of functionality inherit to python?
@ShannonStrutz Sphinx
That's what's used to build in Python docs, and it's pretty powerful. Mixing it with autodoc gives you similar functionality to javadocs, although it's intended for more curated docs.
@ThiefMaster, yuck, slash-escaping fixes give me a headache.
There are other tools as well, of course.
interesting
I'll take a look at it, thanks!
14:38
I am trying to understand a small program
def flatten(nested):
try:
for sublist in nested:
for element in flatten(sublist):
yield element
except TypeError:
yield nested

I want to know when is the TypeError:yield nested statement (last 2 lines) work in the program ,I read python docs tutotrial about TypeError but I could not understand any thing the input to the program is some thing like this [[[1], 2], 3, 4, [5, [6, 7]], 8]
@Kevin: the problem is that android does not accept unquotes values even if they contain no characters that require the value to be quoted
@ShannonStrutz It's worth noting that docstrings are not just for external docs - they are part of an object and can be inspected live in-code.
@RegisteredUser, the TypeError occurs when the function tries to iterate through an object that is not iterable. For example, an int is not iterable.
the typeError doesnt come into play until the program runs, basically it makes exceptions in the case the program runs into a runtime error (am I right?)
14:40
@Lattyware , doesn't that also mean that it could cause some sort of errors?
@ShannonStrutz They're accessible by the __doc__ attribute.
@Kevin ok is it always for int or any other case is also implied by TypeError
Also they're used for the excellent doctest module :)
@ShannonStrutz How so?
So it's approximately equivalent to:
def flatten(nested):
    if can_iterate(nested):
        for sublist in nested:
            for element in flatten(sublist):
                yield element
    else:
        yield nested
14:40
wait, my question sounded noobish. I mean does that mean its an actual part of the python program, where as comments are ommitted from compilation?
Yes. docstrings are a part of the program.
@mgilson is the doc attribute, do I use "doc" or is it just "doc". I've never used underscore notation and fucntions and such
@Lattyware okay
__x__() indicates the magic method x - like __init__() is the constructor, or __len__() is the length function. __x__ is a magic attribute. Same deal - it just has some 'magic' behaviour in Python.
interesting... I may have to look at this magic
@Kevin Yes, except it's not look-before-you-leap, and hence more pythonic.
Also note that >=3.3, you can use yield from sublist instead of the inner loop.
And sublist is a bad name - subiterable would be less misleading.
14:44
wait, so if I wanted to create a program that was as small as possible filesize wise, would it be ok to omit the docstrings and replace them with comments
You generally don't strip comments out of Python files before distributing them.
so it would make no difference.
Hi Everyone, sorry for interrupting

is anyone have experienced on Django. I am having issues this
'NullConfig' object has no attribute 'countries'
I am new to Django and this project using packages like, satchmo, node.js etc.
Its really urgent, any help really appreciated.
well I understand that, but i mean if I wanted the filesize to be as small as possible would it be ok to do
function_name
#describe function
over
function_name
"""describe function"""
... You mean to have five less characters?
I mean... I guess, but is that kind of optimization really necessary ever?
@MaNKuR You'll need to give a lot more information than that for us to help.
@MaNKuR I suggest you post an actual question on the site.
@mankur that way we can see what you are talking about
14:48
As they say, use the right tool for the right job. If your target platform has so little space that you want to remove docstrings, just to save five bytes per function, then maybe Python is the incorrect tool.
During checkout process i found this error
i ran ./manage.py loaddata l10n_data
That's the kind of vicious optimization I'd expect to see among Assembly programmers :-)
Assembly is difficult
That or I had an incompetent professor
@Shannon
its a e-commerce site, and came for maintenance.
After set up i found this error
Am i making myself clear or i have elaborate a more
i found this link
https://groups.google.com/forum/#!topic/satchmo-users/KjyChlT3j6s
but answer surprised me more.
@MaNKuR I'm not really familier with Django framework. I've always used Foundation by Zurb for my web framework needs. I was hoping that your question would be more core python
14:54
@MaNKuR You'll need to post the relevant code, as I say, post a full question on the site.
@Lattyware -- thanks for the link :)
It's much harder to have the information in the chat, and you'll be more likely to get an answer on the site.
@mgilson It's my stock one I made after typing out an explanation of list comps for the hundredth time XD.
I also have one for the with statement.
How much detail do you go into for with?
I'm planning a few more - one of looping by index and why it sucks for a start.
14:55
Do you cover __enter__ and __exit__?
Nah, just using it in the context of working with files
If it is a companies website and their private code, just don't put anything up there that could break an NDA
as that's the main usage for new users.
I don't go into creating context managers.
Or just that it is equivalent to the standard:
f = open(filename)
try:
     #stuff
finally:
     f.close()
Proper context for making a series of if statements would be like this:
if Module == 44001 or Module == 44002 or ....etc.
right?
14:57
@mgilson Basically that.
@ShannonStrutz How about if 44001 <= Module <= 44002:?
Or for non-numerical data, if module in ("44001", "44002", ...):
@mgilson its actually supposed to be a string, now that I think about it. Its the model number of an actual piece of equipment
@Lattyware -- FWIW, I find Module in (44001, 44002) to be a little better as the interpreter caches the tuple so it doesn't have to rebuild it every time.
@mgilson Just made that edit.
14:59
@Lattyware, what IDE is that?
I don't see why it couldn't do the same thing with a list literal.
PYCharm
*PyCharm
@mgilson The list is mutable, so if it cached it, uses in multiple places would mutate it.
@Lattyware -- Yes, I understand that, sorry, I mean if it's actually using a literal
oh, I see
There are no handles to the list floating about ...
So I don't see how a user could modify it.
I'm guessing that's an optimization that never made it ...
15:01
I guess if you did something stupid like [1, 2].append(3) it'd then be [1, 2, 3] next time round
obviously, you'd not be accessing it after
@Lattyware -- But you can't use that in an if statement
but I guess someone could inject a function into list that mutated and returned...
if [1,2].append(3)?
it'd be a hell of an edge case, admittedly.
(that's always a False)
or if x in [1,2].append(3): would give a TypeError
Anyway, that's no longer a literal ;-). It's an expression which has a literal in it
15:03
True
Of course, the test would even be most efficient if it could be turned into a frozenset
if x in frozenset((1,2,3)): ...
In my experience, with simple objects, the set is faster for membership test in the average case if len(container) > 3
But, sadly there is no frozenset literal
:-/
We clearly need more bracket characters
and if x in {1,2,3} suffers from the same rebuilding that a list suffers from.
Agreed!
Maybe we could turn ! into a bracket character ...
if x in !1,2,3!
Seems pretty exciting, doesn't it?
I vote we use the upside down ! as the close symbol
?1, 2, 3¿ too
That'd be great for a frozenset in a question.
Yeah ... Of course, then I'd need to remember how to input those characters...
15:08
if x in ¿1, 2, 3?:
:-P
Seriously though, I wouldn't even mind a syntax like f{1,2,3}
yeah, that'd work
I don't think there's anything ambiguous about it ...
so it could be parsed
it'd be just like byte string literals
or unicode literals in 2.x
but, it's not particularly aesthetic ...
15:09
How about, use ordinary parens, but prefix it with some kind of symbol or symbols that identifies it as a frozen set. Ex. frozenset(1,2,3)
(or 3.3?)
@Kevin -- That looks like a function call
since frozenset is a function (which can be shadowed), the wouldn't work
And we couldn't use [ or ] here either as taht looks like a __getitem__
As far as I see, it only works for {}
I suppose there are other options too...
That's the joke :-) any unambiguous sytax for a frozenset literal, wouldn't save you much typing compared to using the existing frozenset function.
You could use some 2-character sequences
@Kevin -- Oh. Well, we were talking about performance and allowing the interpreter to cache the literal since it's immutable.
Which is why I didn't get it :)
There could be something like:
<<1,2,3>>
How about, use the syntax for set literals, but set the font color to "arctic blue"
or: ||1,2,3||
15:13
That's been rejected as it makes the parsing much less simple
Yeah, I figured
they suggested lt and gt for decorators too
We've got significant whitespace already, why not have other kinds of significant formatting? ;-)
among other things
I do like @Kevin's font color argument :)
15:16
𝀀 U+206A CURLY BRACKET ORNAMENT TOPPED WITH SNOW
Problem solved.
Why would the double pipe syntax make parsing more difficult? Is it because you can't distinguish between an "opening" double pipe and a "closing" one?
Alright. Time to tell Guido -- Snowy curly brackets are for frozensets.
I guess it gets hard if you try to nest frozensets...
I was referring to << and >>
I don't think || has been attempted to be used in such a way.
that's especially surprising. I'd expect it would be fairly simple to lexify << into FROZENSET_LITERAL_OPENER or whatever.
or, wait, >> is already used for something else, isn't it...
15:19
yeah, shift
I'm just parroting what was said in the decorator PEP
<<decorator1, decorator2, decorator3>> was one of the proposed syntaxes, IIRC
There's also $ -- Because frozensets are money.
$1,2,3$
15:55
anyone good at diagnosing linux wifi(possibly driver or hardware) problems
cabbage, folks
cabbage ^^
potato?
banana :); melon. You?
beans sadly
15:59
I need asparagus for one of the linux OS's I just installed(Bodhi linux for a friend) but the mods on the forums are less than helpful and I can't figure it out(arch doesnt give me problems like this =D)
sprouts; can't provide asparagus here; the only Linux with which I'm familiar is Ubuntu
well bodhi is based off ubuntu, it just has a different DE
my problem is with NetworkManager
what's it doing/not doing?
it doesn't display the available wifi networks within range until I try to force a connection using hidden network option
then after I try to force it, it kicks in and it shows me all the available networks
I have enable wireless checked
its like the hardware itself is sleeping until its forced to activate
I'm betting on a configuration problem; have you checked the configuration file?
16:05
I have not
I'll give it a shot here when I go on lunch break
see if thats the problem
I'm not on a Linux at the moment, but check the following files to determine what the settings are
~/.gconf/system/networking/wireless/networks
woo hoo - time to dive into PHP.... holds nose ;)
/etc/network/interfaces
@JonClements gee... thanks :-P
the only thing in interface is
auto lo
iface lo inet loopback
are you using a wireless or wired connection?
16:14
Well - ironically, I might be able to find what I'm after more easily if I could search for a "$" sign without having to resort to using regular expressions...
wireless
@JonClements is PHP the unwanted/illegitimate child of C?
and the networkmanager.conf says
[main]
plugin=ifupdown, keyfile

[ifupdown]
managed=false
the interface used by the wireless card should be present in there
have you tried ifconfig?
@JonClements in php? why not use strpos(..) !== false?
16:18
meh, I figured it out
thanks kneel
rhubarb for now
watermelon
take care
@ThiefMaster trying to find in some source code a $ appearing somewhere in a string
That isn't actually a friggin' variable...
How would I make it so that when I run my testing program (it tests my definitions and exception handling and such). When I run it in the python interpreter, it will exit out of the python program but keep the interpreter window up there
?
I keep on needing to retype import sys sys.path.append('path')
import my file
blah
Interpreter window should not actually close unless you explicitly say "exit()"
true, although I can't just import my file again and have it run automatically
I ahve to close it down and restart it to reset all the jazz
16:26
So... your flow is like this:
python
>>> <your code>
<some results>
>>> <here you need "fresh" environment to start your code again>
?
yea, like I get the results. Go fix the problem and then I want to be able to just import the file again but its almost as if its waiting on input
but it can't be since i have no input options in my code
You can just copy the stuff you need to type every time to the buffer and paste it. Python interpreter can handle that.
whenever I do CTRL+V, the interpreter displays ^V
cmd?
Or Unix?
idk, i'm pretty sure its the interpreter.
it looks like the cmd window
although it has the python logo
and the path to the python.exe
16:28
um... right click -> paste?
doesn't handle right clicks
hm, looks liek what I'm using is called, "Python (command line)"
am I using the wrong thing?
click on header -> edit -> past
paste*
ah there we go
thanks
welcome
Works like a charm
06:00 - 17:0017:00 - 00:00

« first day (965 days earlier)      last day (4208 days later) »