Re: Recursion bug...

2005-11-30 Thread ex_ottoyuhr
[EMAIL PROTECTED] 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 nee

Re: Recursion bug...

2005-11-30 Thread ex_ottoyuhr
Devan L wrote: > Well, for one, in your __init__ method, you never do anything with > anOpcode. You simply assign the name 'opcode' to anOpcode. The reason > why everything is the same is that you're accessing > TreeCommand.children or Treecommand.opcode, which is shared by all > instances unles

Re: Recursion bug...

2005-11-30 Thread bonono
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, i

Re: Recursion bug...

2005-11-30 Thread Devan L
ex_ottoyuhr wrote: > To start with, I'm new at Python, so if this is something relatively > ordinary or a symptom of thinking in C++, I apologize... > > Anyhow, I'm currently trying to write a means of generating > genetic-programming functions in Python; the details would be a little > much for a