getting the reference count of an object ...
Wildemar Wildenburger
wildemar at freakmail.de
Fri Mar 3 05:15:22 EST 2006
... how?
I'm writing an app that holds a public data dictionary from which other
objects obtain part of their __dict__ values so they all work on the
same dataset (yes I'm fiendishly clever and a constructor of unreadable
sentences (and code) ;)).
My problem is that I haven't found an easy way to determine if said
dictionary contents are still in use (so it is ok to delete them from
the dictionary). I've thought about creating a dict subclass that counts
the number of assignments and deletions but that seems cumbersome (an
bug-prone).
Is there a way to get the reference count of these datadict items? I
imagine that this would be a more stable implementation of such a feature.
Hope this gets my problem accross; if not just bash me and I'll
reformulate. I'm not the best of explainers.
Oh, and sorry if the solution to my problem is obvious (such as an
__refcount__ attribute or some stupid oversight like that).
c.u.
wildemar
More information about the Python-list
mailing list