Mizipzor wrote: > class Stats: > def __init__(self, *li): > self.speed = li[0] > self.maxHp = li[1] > (...) > > Or maybe there is an even niftier way that lets me iterate through > them?
Using keyword arguments instead of positional parameters makes this easy: >>> class Stats: ... def __init__(self, **kw): ... self.__dict__.update(kw) ... >>> stats = Stats(speed=10, maxHp=100, armor='plate mail') >>> stats.speed 10 >>> stats.maxHp 100 >>> stats.armor 'plate mail' Jeffrey -- http://mail.python.org/mailman/listinfo/python-list