[Andrew Koenig describes a proposal to redefine 'if' for immutables] [Phillip Eby] > > 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. [Andrew] > 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 implementation. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4