None assigment

D-Man dsh8290 at rit.edu
Sun Feb 18 21:56:45 EST 2001


On Sun, Feb 18, 2001 at 09:35:37PM +0000, Fredrik Lundh wrote:
| 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...

True (been there, done that,  with other guns), but,  my terminal is
only 24 lines long.  Functions that don't fit on the screen (usually)
need to be split up better.

:-)

-D





More information about the Python-list mailing list