Recursion bug...

bonono at gmail.com bonono at gmail.com
Wed Nov 30 22:25:43 EST 2005


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.




More information about the Python-list mailing list