News for hackers. Stuff that matters.
Re:Python idiom for taking the single item from a list by mikeklaas on Monday September 27, 2010 @02:21PM (#1732723)
The brackets are optional; you can also write

thing, = [stuff]

though some people think that it's less legible since it has a completely different meaning without the comma.

EDIT: you can even play with the whitespace and pretend that ",=" is a list->scalar conversion operator:

x ,= [1]

Re:Python idiom for taking the single item from a list by StavrosK on Monday September 27, 2010 @02:30PM (#1732771)
I know about the optional parentheses, but omitting them makes the comma very easy to overlook :/ I do like your fake operator idea, but it seems that it would go against the spirit of python and make it easier at the expense of readability...