[Python-Dev] redefining is (original) (raw)
Tim Peters tim.one at comcast.net
Sat Mar 20 01:20:18 EST 2004
- Previous message: [Python-Dev] redefining is
- Next message: [Python-Dev] redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Andrew Koenig]
... Also, I think that in general, operations that should be used only by people who really know what they're doing should be harder to express.
Yet another argument for removing floating point <0.898 wink>.
While "is" serves a useful purpose in Python, I wouldn't mind if it were harder to spell. There have indeed been serious bugs due to misuse of "is", even in Python's standard library. The most notorious is that, until rev 1.15, asynchat.py used
buf is ''
in a conditional and got away with it for 3 years. This one is especially sucky because I'm sure the author knew better, but was obsessed with speed so talked himself into believing that CPython represents the empty string uniquely. It doesn't -- but it's not easy to find a counterexample!
a = "" b = "" a is b True "abc"[:0] is "def"[:0] is a is "" is str(u"") is ""+"" is ""*0 True import sys sys.stdin.read(0) is a True import array buf = array.array('c', "") buf.tostring() is a True
If you give up , see the checkin comment for asynchat.py rev 1.15.
- Previous message: [Python-Dev] redefining is
- Next message: [Python-Dev] redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]