Recursive class | can you modify self directly?

Ian Kelly ian.g.kelly at gmail.com
Tue Jul 9 18:20:47 EDT 2013


On Tue, Jul 9, 2013 at 4:18 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> If you actually want to modify the current object, you would need to
> do something like:
>
>     def expand(self):
>         import copy
>         self.expr = Expr(self.expr, self.op, self.val)
>         self.op = choice('+-*/')
>         self.val = choice('12345')

Minus the "import copy".  I modified the code before sending and
forgot to remove that.



More information about the Python-list mailing list