Weird behavior with lexical scope

Kirk Strauser kirk at daycos.com
Thu Nov 6 13:50:57 EST 2008


At 2008-11-06T16:57:39Z, mrstevegross <mrstevegross at gmail.com> writes:

> class Outer:
>   class Inner:
>     def __init__(self):
>       pass
>   def __init__ (self):
>     a = Inner()
> Outer()

Try instead:

class Outer:
    def __init__(self):
        a = self.Inner()


-- 
Kirk Strauser
The Day Companies



More information about the Python-list mailing list