Is there a better algorithm?
J Kenneth King
james at agentultra.com
Fri Jan 2 16:06:48 EST 2009
Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> Kottiyath <n.kottiyath at gmail.com> writes:
>> I have the following list of tuples:
>> L = [(1, 2), (3, 4, 5), (6, 7)]
>> I want to loop through the list and extract the values.
>
> Others have suggested messy ways to code what you're asking. At another
> level, that list format seems like a code smell. You may be better off
> organizing the program so that
>
> L = [(1, None, 2), (3, 4, 5), (6, None, 7)]
>
> after which unpacking becomes trivial.
Very true. +1
More information about the Python-list
mailing list