Re:Python idiom for taking the single item from a list
by digitallogic on Monday September 27, 2010 @02:43PM
(#1732824)
Depends on which is more important. If it's an egregious error for there to be more than one element then I'd prefer the unpacking solution. However if ordering is/was involved at some point a set would indicate a possible bug (since they're unordered) so I might lean towards indexing.
They are both decent ideas, not hard fast rules. Let your context be your guide.
They are both decent ideas, not hard fast rules. Let your context be your guide.