>
> Me: For non-singleton immutables, identity is not really a meaningful
> thing.  I mean, other than in a debugger or code profiler, or something
> special like that. I honestly do not know whether, e.g. '(1, "a", 3.5) is
> (1, "a", 3.5)'.  I'll go try it, but I won't be sure the answer for every
> implementation, version, and even runtime, whether that answer will be
> consistent.
>

So I did try it.  I did not necessarily expect these particular results.
Moreover, I have a hunch that with PyPy JIT, something similar might
actually give different answers at different points when the same line was
encountered in a running interpreter.  Not this example, but something else
that might cache values only later.

I haven't done anything sneaky with the version at those paths.  They are
all what the environment name hints they should be.  PyPy is at 3.6, which
is the latest version on conda-forge.

810-tmp % $HOME/miniconda3/envs/py2.7/bin/python -c 'print((1, "a", 3.5) is
(1, "a", 3.5))'
False
811-tmp % $HOME/miniconda3/envs/py3.4/bin/python -c 'print((1, "a", 3.5) is
(1, "a", 3.5))'
False
812-tmp % $HOME/miniconda3/envs/py3.8/bin/python -c 'print((1, "a", 3.5) is
(1, "a", 3.5))'
<string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True
813-tmp % $HOME/miniconda3/envs/pypy/bin/python -c 'print((1, "a", 3.5) is
(1, "a", 3.5))'
True
814-tmp % $HOME/miniconda3/envs/py1/bin/python -c 'print (1, "a", 3.5) is
(1, "a", 3.5)'
0

-- 
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/CEY555UH7WTD3REM3LAQ44TP2OV3KR4C/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to