2.6, 3.0, and truly independent intepreters

greg greg at cosc.canterbury.ac.nz
Sun Oct 26 01:58:44 CEST 2008


Glenn Linderman wrote:
> On approximately 10/25/2008 12:01 AM, came the following characters from 
> the keyboard of Martin v. Löwis:
> 
>> If None remains global, then type(None) also remains global, and
>> type(None),__bases__[0]. Then type(None).__bases__[0].__subclasses__()
>> will yield "interesting" results. This is essentially the status quo.
>
> I certainly don't grok the implications of what you say above, 
> as I barely grok the semantics of it.

Not only is there a link from a class to its base classes, there
is a link to all its subclasses as well.

Since every class is ultimately a subclass of 'object', this means
that starting from *any* object, you can work your way up the
__bases__ chain until you get to 'object', then walk the sublass
hierarchy and find every class in the system.

This means that if any object at all is shared, then all class
objects, and any object reachable from them, are shared as well.

-- 
Greg



More information about the Python-list mailing list