help needed with class and method confusion

Cndistin cndistin at
Tue Jan 6 16:22:32 CET 2004

First I am sorry for the title but I an newbie enough to now know how to better
word it.

The problem part of my code is
class Application:
    class Moon:
        def __init__(self, name):
   = name
    def __init__(self):
        self.moons = []
        names = ["Io", "Europa", "Ganymeade"]
        for name in names:
            setattr(self, name, Moon(name))
I would like to somehow get self.moons to equal
[self.Io, self.Europa, self.Ganymeade]. I had hoped on using
self.moons as an iterant in "for" loops to be able to alter each
in turn.

Thanks in advance for any possible help.

More information about the Python-list mailing list