[Python-Dev] metaclass insanity

Thomas Heller thomas.heller@ion-tof.com
04 Nov 2002 22:10:42 +0100

Guido van Rossum <guido@python.org> writes:

> Can someone provide a reason why you'd want to use nested classes?
> I've never felt this need myself.  What are the motivations?

Nested classes provide a nice way (IMO) to write metaclasses and keep
them near the classes using them:

class X(object):
    class __metaclass__(type):