None assigment

Fredrik Lundh fredrik at pythonware.com
Sun Feb 18 22:35:37 CET 2001


Thomas Wouters wrote:
> It's *mostly* harmless. Consider
>
>   spam, None, eggs, None = string.split("this is a string")
>   viking = filter(None, (spam, eggs))

now put them both in the same function, with the filter
statement on line 5 and the split on line 65.

trust me, you can waste lots of time trying to figure out
what causes that "NameError: None" message on line 5...

Cheers /F





More information about the Python-list mailing list