In article <mailman.3435.1239058603.11746.python-l...@python.org>,
Rhodri James <rho...@wildebst.demon.co.uk> wrote:
>
>You'll note that this is, all Aaron's protests to the contrary,
>splitting your class up into multiple cooperating classes.  

Ayup.

>If you're set on doing it like this, doing it this way avoids polluting
>your namespace so much:
>
>class ClsB(object):
>     class ClsA(object):
>         def do_something(self):
>             print "Here's A doing something"
>
>     def __init__(self):
>         self.A = ClsB.ClsA()
>
>     def do_something(self):
>         print "Here's B doing something"

Blech.  The pollution caused by a separate class is minimal, and nested
class definitions are likely to have problems (the most obvious is that
pickling will break).
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to