Recursion bug...

2005-11-30 Thread ex_ottoyuhr
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 Usenet post, but suffice it to

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 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" var

Mutability of function arguments?

2005-12-07 Thread ex_ottoyuhr
I'm trying to create a function that can take arguments, say, foo and bar, and modify the original copies of foo and bar as well as its local versions -- the equivalent of C++ funct(&foo, &bar). I've looked around on this newsgroup and elsewhere, and I gather that this is a very common concern in

Re: Mutability of function arguments?

2005-12-07 Thread ex_ottoyuhr
(Re. mutability question:) Update, never mind. I found that the FooWrapper solution isn't so bad after all -- and even better is putting the variable in question in a different module entirely. However, anyone who wants to answer the question is still welcome to. Sorry to be a bother, and to have