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

Ian Kelly ian.g.kelly at gmail.com
Tue Apr 23 18:22:57 EDT 2013


On Tue, Apr 23, 2013 at 3:50 PM, vasudevram <vasudevram at gmail.com> 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.



More information about the Python-list mailing list