Classes in a class: how to access variables from one in another

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Oct 18 18:29:31 CEST 2010


fab at slick.airforce-one.org wrote:
> Christian Heimes <lists at cheimes.de> wrote:
>   
>> Don't nest classes. Just don't. This might be a valid and good approach
>> in some programming languages but it's not Pythonic. Your code can
>> easily be implemented without nested classes.
>>     
>
> I think you're right. It would have been more aesthetically pleasant
> to me (a Handle has only sense on a drawing zone), but if it's more
> complicated I'll avoid nested classes.
>
>   
I would disagree to the point. Nested classes are perfectly fine, class 
can but used as class and/or namespaces.
However Nested classes are rarely absolutely required so if you decide 
not to use them, that's not a big deal.

JM



More information about the Python-list mailing list