On 3 December 2010 16:45, "Martin v. Löwis" <mar...@v.loewis.de> wrote: >> Oh my bad, I must've confused python with some research paper. >> Unique id is not so hard to make without an address. >> >> While on this topic, what is the real need for unique ids? > > They are absolutely needed for mutable objects. For immutable ones, > it would be ok to claim that they are identical if they are equal > (assuming they support equality - which is tricky for things like NaN).
Indeed, but do ids really need to be unique and fixed at the same time? a is b # (if atomic) needs unique ids, but doesn't really need fixed ids a[b] # needs fixed hash, but not strictly a globally unique id I can imagine an implementaion of pickle for example that uses unique and fixed as a given to detect cycles, etc; but that would be implementation detail. It seems to me unique and fixed id implies that it is stored somewhere (with incref beforehands and decref afterwards), however a proper reference to an object could be used just as well. Am I still missing something? > > Of course, the C API has lots of assumptions that identity and address > are really the same thing. > > Regards, > Martin > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com