<br><br><div class="gmail_quote">On Fri, Mar 20, 2009 at 10:06 AM, Esmail <span dir="ltr"><<a href="mailto:ebonak@gmail.com">ebonak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br>
<br>
I am curious why nested classes don't seem to be used much in Python.<br>
I see them as a great way to encapsulate related information, which is<br>
a<br>
good thing.<br>
<br>
In my other post "improve this newbie code/nested functions in<br>
Python?"<br>
(I accidentally referred to nested functions rather nested classes -<br>
it was late)<br>
I asked something similar in the context of a specific example where I<br>
think the<br>
use of nested classes makes sense.<br>
<br>
But perhaps not?<br>
</blockquote><div><br>Nested classes in Python don't add much other than an additional level of complexity (and an extra hash lookup). Behavior in python is usually grouped into modules, not into classes. The only reason to nest a class in Python is if the first class is going to generate the second class on the fly.<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Esmail<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>