What other languages use the same data model as Python?

harrismh777 harrismh777 at charter.net
Wed May 4 20:46:57 EDT 2011


John Nagle wrote:
>     Arguably, Python should not allow "is" or "id()" on
> immutable objects.  The programmer shouldn't be able to tell when
> the system decides to optimize an immutable.
>
> "is" is more of a problem than "id()"; "id()" is an explicit peek
> into an implementation detail.

Yes, yes, yes...  and I'll go you one more...

... Python should optimize on *all* immutables when possible.


For instance:

a = (1,2,3)
b = (1,2,3)

a == b  True

a is b  False

    To be consistent, in this case and others, a and b should reference
the same immutable tuple.


Or, as stated earlier, Python should not allow 'is' on immutable objects.


kind regards,
m harris




More information about the Python-list mailing list