Wow: list of immediate subclasses?

Roman Suzi rnd at onego.ru
Sun Aug 3 01:12:17 EDT 2003


On Fri, 1 Aug 2003, Andrew Dalke wrote:

>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.
>
>It's a bit too mysterious for my liking.

I wonder why to have __subclasses__() at all... I recall somebody
(Tim Peters?) tolds us that classes are essentially just 
dictionaries - everything else is an imagination by OO-brains
and fluffy operations like computing MRO. __subclasses__ aren't
needed for OO to work. What for they really are? Just to have nice way
to know subclasses? Why not to use some external framework for that task,
hooking object manipulation to some routine if necessary?

I can't find any reference to __subclasses__ in standard library!
(I was looking for __subclasses__ string)


Sincerely yours, Roman Suzi
-- 
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3






More information about the Python-list mailing list