On Sep 12, 11:48 pm, Daniel Luis dos Santos <daniel.d...@gmail.com> wrote: > Hello, > > I have an object definition : > > class primitive: > > def __init__(self) > self.name = "" > self.transforms = [] > > def copy(self, copyName) > > copy = self.copyInternalState(copyName) # method defined > elsewhere > in derived class > > if self.transforms != [] > for transf in self.transforms > copy.transforms.append(transf.copy()) > > In short, what I want to is to have the transforms list as an instance > attribute of the class. I will add objects to it. When I call the copy > method on the object the list is to be copied to the new object. > > Problem is that the python interpreter is complaining that it doesn't > know any self.transforms in the if statement. > > Help
1. Always post the actual code - the code you posted is not valid Python as many colons (:) are missing. 2. You appear to be attempting to use the same name (copy) both as a method name AND as a local variable of that method. This definitely look wrong. Perhaps if you could post the actual offending code (the smallest example showing the problem you observe) others might be able to help you. Cheers, André -- http://mail.python.org/mailman/listinfo/python-list