Assigning to None

François Pinard pinard at
Fri Jul 1 21:00:32 CEST 2005

[Roy Smith]

> 4) foo, bar = gen_tuple(stuff)[0:1].  In some ways, this is the
>    cleanest because it doesn't pollute the namespace with an un-needed
>    variable, but I think it's the least readable.

Less legible often means more error prone.  For example, here,

     foo, bar = gen_tuple(stuff)[:2]

would work better.

François Pinard

More information about the Python-list mailing list