Accessing parent objects

Ian Kelly ian.g.kelly at gmail.com
Sun Mar 25 10:09:02 EDT 2018


On Sun, Mar 25, 2018 at 5:46 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Sun, 25 Mar 2018 06:11:53 -0500, D'Arcy Cain wrote:
>> It accesses the parent class.  I want to access the parent object.
>
> Ah. Well, no wonder it doesn't work: you're confusing the OO inheritance
> concept of "parent" (a superclass) with whatever relationship you have
> between one instance and another instance. Just because they share the
> same name doesn't make them the same concept.

No, he's merely confusing the concept of nested classes in Python with
nested classes in Java, which actually supports this magic.

To the OP: Python isn't Java. Nested classes in Python work like
"static" nested classes in Java.



More information about the Python-list mailing list