Seemingly odd 'is' comparison.
Asun Friere
afriere at yahoo.co.uk
Mon Feb 18 23:09:16 EST 2008
On Feb 19, 1:45 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> "Asun Friere" <afri... at yahoo.co.uk> wrote in message
>
> news:8cafcd9e-6a61-483f-b8f3-6e7b0e5ab435 at s8g2000prg.googlegroups.com...
> | The advice not to identity test strings and numbers (since they are
> | interred in the main implementation),
>
> They may or may not be.
Obviously, and that is the problem. The behaviour will appear
inconsistent unless one is familiar with the conditions under which
they are or are not. So since the numbers and strings are interned
(under certain conditions), it is probably best not to identity test
them.
>
> Ditto for tuples, unless possibly when they have mutable members.
>
Which is the reason that they are never interned in CPython, no? So I
was wrong, the categorical avoidance of identity testing is probably
_not_ sound advice with regard to tuples.
> | But given the nature of
> | immutables, is the identity of these even potentially implementation
> | dependant (ie. they couldn't be interred could they)?
>
> The word is 'interned', not 'interred' (buried).
>
Sorry I'm a goth, so you can understand my mistake ;=
So was that a yes or no? I mean is it even possible for the identity
behaviour of mutables to vary between implementations? I can't see
how they can possibly be interned, but is there some other factor I'm
missing in regard to identity behaviour which could in fact vary
between implementations?
More information about the Python-list
mailing list