Puzzled by "is"

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Aug 9 21:13:39 EDT 2007


Grzegorz Słodkowicz <jergosh at wp.pl> writes:

> That's just theorisation but I'd rather expect the interpreter
> simply not to create a second tuple while there already is an
> identical one.

Others have already said that it's an implementation optimisation,
which seems to partly answer your question.

It's important to also realise that the language is *deliberately*
non-committal on whether any given value will have this behaviour;
that is, it's entirely left to the language implementation which
optimisation trade-offs to make, and the language user (that's you and
I) should *not* expect any particular behaviour to hold between
different implementations.

-- 
 \         "Holy priceless collection of Etruscan snoods, Batman!"  -- |
  `\                                                             Robin |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list