Any other Python flaws?
Michael Chermside
mcherm at destiny.com
Fri Jun 15 15:18:04 EDT 2001
Martijn writes:
> Further things possibly wartlike, though this one never bit me, is
> the possibly to assign to None, definitely a weird idea when you
> first encounter it.
Gee... I had no idea this was possible. Surely it's a bad idea... right?
Can anyone name any reason why it's good to be able to assign to None?
Barring that, I figure there must be a good reason why this isn't a
syntax error. None not being a reserved word may be part of it... it's
just another value in __builtins__. This is a clean and elegent design,
but there's something dangerous about being able to change None.
Oh well... at least people don't bump into this one much. And if you
accidently clobber it, you can restore things with:
def __None():
pass
None = __None()
I guess I better start putting that at the top of all my modules as
defensive programming <1.0 wink>.
-- Michael Chermside
More information about the Python-list
mailing list