Re: use class in class

2014-01-21 Thread Robert Voigtländer
> > copy/paste of the whole thing. The actual error message could not > > have said "node", as there's no such name in the method. > You are correct. I copied the error before I renamed node into Node. I have to be more consistent here. :-) The source for the error was still the same. -- ht

Re: use class in class

2014-01-21 Thread Robert Voigtländer
> I recommend using a different name for the instances here, probably > > with a lower-case first letter. That would solve your problem _and_ > > make your code more readable. Thanks a lot! I was confused by the debuger gifing me the wrong line as containing the error. I changed it regarding yo

Re: use class in class

2014-01-21 Thread Chris Angelico
On Tue, Jan 21, 2014 at 9:20 PM, Robert Voigtländer wrote: > def calcRoute(self): > self.openlist.append(Node(self.start, None, 0, 0)) > for Node in self.openlist: print Node.pos, Node.parent, Node.g, > Node.h, Node.f You're using the name Node to mean two different things. I

use class in class

2014-01-21 Thread Robert Voigtländer
Hi, I have a problem using a class object within another class. It is about the line: self.openlist.append(Node(self.start, None, 0, 0)) If I use it in __init__ it works. If I use it in calcRoute(self) I get the following error: local variable 'node' referenced before assignment The error occ