Recursive class | can you modify self directly?
Russel Walker
russ.pobox at gmail.com
Wed Jul 10 05:00:54 EDT 2013
On Wednesday, July 10, 2013 12:20:47 AM UTC+2, Ian wrote:
> 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.
Yes! This is exactly it. Thanks :)
More information about the Python-list
mailing list