On Fri, Jul 8, 2011 at 1:49 AM, Alex Gaynor <alex.gay...@gmail.com> wrote: > Hi all, > I've now spoken with several developers about the object identity that > arises out of hte new dict strategies, and all seem to think that the > current implementation breaks Python's semantics, that is: > x = 3 > z = {x: None} > assert next(iter(z)) is x > will fail. The only solution I see to this that maintains the correct > semantics in all cases is to specialize is/id() for primitive types. That > is to say, all integers of any given value have the same id() and x is y is > true. Doing x is y is true is easy, you simply have a multimethod which > dispatches on the types and compares intval for W_IntObjects (objects of > differing types can never have the same identity) however the question is > what to use for id() that is unique, never changes for an int, and doesn't > intersect with any other live object. In particular the last constraint is > the most difficult I think. > Alex
>>> x = 3 >>> x is 3 True >>> x = 1003 >>> x is 1003 False >>> Stop relying on obscure details I think _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev