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
--
http://mail.python.org/mailman/listinfo/python-list