None assigment

Thomas Wouters thomas at xs4all.net
Sun Feb 18 16:10:53 EST 2001


On Sun, Feb 18, 2001 at 05:02:10PM +0000, Marcin 'Qrczak' Kowalczyk wrote:
> Sat, 10 Feb 2001 18:09:18 -0800, Clarence Gardner <clarence at netlojix.com> pisze:

> > I think, if there is a reason, it is probably that they want the
> > language to prevent the programmer from *accidentally* doing bad
> > things that happen to be possible.  But nobody types
> > 	None = 3
> > by accident.

> It's harmless anyway: it rebinds a local name, not the builtin one.

It's *mostly* harmless. Consider

  spam, None, eggs, None = string.split("this is a string")
  viking = filter(None, (spam, eggs))

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list