Filling in a tuple from unknown size list

John Machin sjmachin at lexicon.net
Fri Nov 27 19:02:39 EST 2009


On Nov 27, 11:18 pm, boblatest <boblat... at googlemail.com> wrote:
> Hello all,
>
> (sorry for posting from Google. I currently don't have access to my
> normal nntp account.)
>
> Here's my question: Given a list of onknown length, I'd like to be
> able to do the following:
>
> (a, b, c, d, e, f) = list
>
> If the list has fewer items than the tuple, I'd like the remaining
> tuple elements to be set to "None". If the list is longer, I'd like
> the excess elements to be ignored.

WRONG -- sweeping excess input under the carpet is a nasssssty perlish
trick.



More information about the Python-list mailing list