[Python-Dev] A proposal has surfaced on comp.lang.python to
Guido van Rossum
guido at python.org
Wed Mar 17 18:45:32 EST 2004
[Andrew Koenig describes a proposal to redefine 'if' for immutables]
> > Three reasons why not:
> > Simple is better than complex.
> > In the face of ambiguity, refuse the temptation to guess.
> > If the implementation is hard to explain, it's a bad idea.
I'm not sure any of those apply to Andrew's proposal though.
> And a reason on the other side:
> Don't expose the implementation to users needlessly.
> This kind of implementation-defined behavior makes me nervous,
> because it makes it easy to write programs with bugs that no amount
> of testing can ever reveal.
I'm curious what the reason is to want to redefine 'is' for
immutables. If I understand Andrew, it's fix broken programs after
the fact (almost as if by time machine :-).
It seems to me that 'is' should never be used for immutables except
for singletons like None. Perhaps PyChecker should warn about
inappropriate use of 'is' to compare two immutable objects, unless one
of them is None? This would be a cheaper solution than changing the
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev