What is the reason for defining classes within classes in Python?

vasudevram vasudevram at gmail.com
Tue Apr 23 19:13:57 EDT 2013


On Wednesday, April 24, 2013 3:52:57 AM UTC+5:30, Ian wrote:
> On Tue, Apr 23, 2013 at 3:50 PM, vasudevram  wrote:
> 
> >
> 
> > Hi list,
> 
> >
> 
> > I saw an example of defining a class within another class, here, in the docs for peewee, a simple ORM for Python:
> 
> >
> 
> > http://peewee.readthedocs.org/en/latest/peewee/quickstart.html
> 
> >
> 
> > In what way is this useful?
> 
> 
> 
> In that particular case they're just using it as a namespace.  Django
> 
> does the same thing.

Not clear. An example or more explanation might help, if you can. Thanks.



More information about the Python-list mailing list