Tim Peters wrote:
The dict itself keeps the objects alive.
Yes, but the idea of a cache is that you're free to flush things out of it to make room for something else without breaking anything. It sounds like MRAB is using ids as weak references, without the assurance actual weak references give you that they become invalidated when the refefenced object goes away,
No such uses care about object addresses, though - just that id(obj) returns a value usable as a dict key, unique among all reachable objects at the time `id()` is called.
Yep. In hindsight it was probably a mistake for the docs to talk about addresses in relation to id() -- it seems to have given some people unrealistic expectations. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com