[Tutor] listing classes

Alan Gauld alan.gauld at btinternet.com
Tue May 20 20:10:27 CEST 2008


"Laureano Arcanio" <listas.condhor at gmail.com> wrote

> I need to have a listing of all classes defined inside a class body,
> something like this:
>
> class A(object):
>    class B(object):
>        pass
>    class C(object):
>        pass(object):

Others have answered but I'm curious why you would want
to have such a structure. Defining nested classes is a fairly
unusual construct only used under fairly specific conditions.
It also limits reuse opportunities and flexibility quite a bit.

Is there any reason why you can't just define the classes
individually and put them in a list or dictionary? That would
be much simpler.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list