Re: Need help with simple OOP Python question

2011-09-05 Thread Kristofer Tengström
Thanks everyone, moving the declaration to the class's __init__ method did the trick. Now there's just one little problem left. I'm trying to create a list that holds the parents for each instance in the hierarchy. This is what my code looks like now: - cla

Need help with simple OOP Python question

2011-09-04 Thread Kristofer Tengström
Hi, I'm having trouble creating objects that in turn can have custom objects as variables. The code looks like this: - class A: sub = dict() def sub_add(self, cls): obj = cls() self.sub[obj.id] = obj class B(A): id = 'inst'