[Python-Dev] redefining is (original) (raw)
François Pinard pinard at iro.umontreal.ca
Sat Mar 20 08:45:07 EST 2004
- Previous message: [Python-Dev] redefining is
- Next message: [Python-Dev] redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Tim Peters]
buf is ''
There is question which traversed my mind recently. While I would
never use is' between ordinary strings, I might be tempted to use
is'
between explicitely interned strings, under the hypothesis that for
example:
a = intern('a b')
b = intern('a b')
a is b
dependably prints `True'. However, I remember a thread in this forum by which strings might be un-interned on the fly -- but do not remember the details; I presume it was for strings which the garbage collector may not reach anymore.
There are a few real-life cases where speed considerations would invite
programmers to use is' over
==' for strings, given they all get
interned to start with so the speed-up could be gleaned later. The fact
that `is' exposes the implementation is quite welcome in such cases.
-- François Pinard http://www.iro.umontreal.ca/~pinard
- Previous message: [Python-Dev] redefining is
- Next message: [Python-Dev] redefining is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]