On 08/07/11 17:19, Armin Rigo wrote: > As I said in my previous e-mail, I think that e.g. copy.py relies on > such behavior, and more generally any Python code that has to use id() > to emulate an identity-dict --- as broken as that approach is, just > because CPython thought that identity-dicts were unnecessary. > > It may not actually be a problem right now in copy.py, but still, I > fear that it's a problem waiting to hurt us.
I don't think that copy.py relies on this behavior (even after looking at the code, but I might wrong). My point is that we are not breaking id(); identity dicts emulated using id() continue to work as normal. The only assumption that we are breaking is this one, which has nothing to do with identity dicts or id(). d = {} d[x] = None assert d.keys()[0] is x As fijal points out, the semantics of this particular behavior is already half-broken, even in CPython. E.g., in the following example we never remove anything from the dictionary, nevertheless a key "disappears": x = 1003 d = {x: None} assert d.keys()[0] is x d[1000+3] = None assert d.keys()[0] is x # BOOM ciao, Anto _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev