Wow: list of immediate subclasses?
Michael Hudson
mwh at python.net
Fri Aug 1 07:29:11 EDT 2003
Michael Hudson <mwh at python.net> writes:
> "Andrew Dalke" <adalke at mindspring.com> writes:
>
> > Carl Banks, responding to Roman Suzi:
> > > __subclasses__ is a list of weak references, so the class can be
> > > collected even though it's listed in __subclasses__. For whatever
> > > reason, class A isn't deleted by reference counts, but cyclic garbage
> > > collection gets it.
> >
> > But I want to know that reason. Why are there any cycles?
[...]
>
> I don't know where the cycle is, off-hand. I suspect I did once...
Found it (them):
>>> class A(object): pass
...
>>> A.__dict__['__weakref__'].__objclass__ is A
True
praise-be-to-neils-ly y'rs
mwh
--
I never disputed the Perl hacking skill of the Slashdot creators.
My objections are to the editors' taste, the site's ugly visual
design, and the Slashdot community's raging stupidity.
-- http://www.cs.washington.edu/homes/klee/misc/slashdot.html#faq
More information about the Python-list
mailing list