A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/043366.html below:

[Python-Dev] redefining is

[Python-Dev] redefining is [Python-Dev] redefining isFrançois Pinard pinard at iro.umontreal.ca
Sat Mar 20 08:45:07 EST 2004
[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

More information about the Python-Dev mailing list

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