News for hackers. Stuff that matters.
Re:Python idiom for taking the single item from a list by DougBTX on Monday September 27, 2010 @02:55PM (#1732881)
I prefer array.single(), I think it's a rare enough use-case that spelling out what you are doing is worthwhile.
Re:Python idiom for taking the single item from a list by j_baker on Monday September 27, 2010 @03:25PM (#1732990)
Are you talking about another language?

1) In python, arrays and lists are two very different things.

2) Neither the array module nor the array class have a single function.

Re:Python idiom for taking the single item from a list by DougBTX on Thursday September 30, 2010 @08:35AM (#1743049)
The example came to mind via C#. I assumed that it could be added to Python via a mixin or whatever if you wanted to do it there.