On inner classes

Bjorn Pettersen BPettersen at NAREX.com
Mon Feb 25 14:31:38 EST 2002


> From: Gonçalo Rodrigues [mailto:op73418 at mail.telepac.pt] 
> 
> Suppose we have something like
> 
> class <name>:
>     class <name>:
>         <whatever>
>     <whatever>
> 
> that is, a class defined inside another. How can the inner 
> class acess the methods/attributes of the outer one?

I'm assuming you're meaning something like:

  class Outer:
     def outerMethod(self):
        class Inner:
           def innerMethod(this):
              self.outerMethod() # call class Outer's outerMethod

-- bjorn




More information about the Python-list mailing list