Recursion bug...

ex_ottoyuhr ex_ottoyuhr at hotmail.com
Thu Dec 1 04:45:04 CET 2005


Devan L wrote:
<Snip my original>

> 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 unless you assign to it.

OK, _that's_ what I was doing wrong... Thanks a lot. I suspected it
might be a product of C++-isms and being self-taught in the language...

> And you never increment generated,
> so I don't see why the while loop would ever end, unless you
> intentionally wanted that.

I just forgot to add that part -- I was demi-transcribing it, you might
put it, as opposed to actually copying. There were a few bugs in that
part... :P

> Try this code instead:
> 
<snip>




More information about the Python-list mailing list