Recursion bug...

ex_ottoyuhr ex_ottoyuhr at hotmail.com
Wed Nov 30 22:46:58 EST 2005


bonono at gmail.com wrote:
> ex_ottoyuhr wrote:
> > class TreeCommand:
> >     opcode = 0
> >     children = []
> >     def __init__(self, anOpcode) :
> >         opcode = anOpcode
> >
> opcode and children in this case is more like "class" variable in C++.
> If you want "instance" variable, you need to do it as self.opcode,
> self.children, in all methods.

Thanks a lot. I'm sorry to have bothered you and the newsgroup with
such a simple problem, but then again, I'm glad it was simple, and I
suppose that's what newsgroups are for... :)




More information about the Python-list mailing list