Weird behavior with lexical scope

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Nov 7 16:22:47 EST 2008


In message <mailman.3599.1226010740.3487.python-list at python.org>, Terry
Reedy wrote:

> saju.pillai at gmail.com wrote:
>
>> class Outer:
>>    def __init__(self):
>>       class Inner:
>>          def __init__(self): pass
>>       a = Inner()
> 
> This create a duplicate Inner class object for every instance of Outer,
> which is almost certainly not what the OP wants.

Does it matter?



More information about the Python-list mailing list