List of Objects

Alex Martelli aleax at mac.com
Thu Apr 19 23:33:58 EDT 2007


<datamonkey.ryan at gmail.com> wrote:

> Howdy, a (possibly) quick question for anyone willing to listen.
> I have a question regarding lists and Classes; I have a class called

It looks you don't really want what you're saying: you appear to want a
list of INSTANCES of one class, *NOT* a list of CLASSES.  E.g.:

class Gazelle(object): pass

class Zip(Gazelle): pass

class Zop(Gazelle): pass

class Zap(Gazelle): pass

thelist = [Zip, Zop, Zap]


Now THIS would be a list of classes, but contextual clues in your text
appear to suggest that you do NOT want this, and may be deeply mistaken
about what "a list of classes" means.  I'd rather get confirmation of
that point before I address your question; if you use totally,
irretrievably wrong terminology, miscommunication's likely:-(.


Alex



More information about the Python-list mailing list