Add lists to class?

BBands bbands at gmail.com
Fri Sep 2 19:49:01 EDT 2005


> Why don't you use a real list instead?

I am using lists... I just showed the naming schema. Here is how they
are implemented.

for var in range(len(self.symbols)):
    setattr(self, "_" + str(var), [])

> I don't understand what
> self.__dict__["_" + str(var)] gets you.

It let's me access lists that aren't known at write time.

    jab




More information about the Python-list mailing list