Wow: list of immediate subclasses?
mwh at python.net
Tue Aug 5 14:48:31 CEST 2003
"Andrew Dalke" <adalke at mindspring.com> writes:
> Michael Hudson:
> > >>> A.__dict__['__weakref__'].__objclass__ is A
And *then* I find how I should have found <wink> the cycle:
>>> class A(object): pass
>>> pprint.pprint([r for r in gc.get_referrers(A) if r is not __main__.__dict__])
[<attribute '__dict__' of 'A' objects>,
<attribute '__weakref__' of 'A' objects>,
(<class '__main__.A'>, <type 'object'>)]
Forgot about the obvious A.__mro__ is A cycle!
A difference which makes no difference is no difference at all.
-- William James (I think. Reference anyone?)
More information about the Python-list