Re: exec behaviour

2005-11-04 Thread N. Pourcelot
Thanks for you reply. I added locals() to my exec statment, so it worked, but I wasn't so sure about my interpretation of the problem. Fredrik Lundh wrote: > N. Pourcelot wrote: > > >>I can't understand some specific behaviour of the exec statment. >> >>For example, say that I create such a cl

Re: exec behaviour

2005-11-04 Thread Fredrik Lundh
N. Pourcelot wrote: > I can't understand some specific behaviour of the exec statment. > > For example, say that I create such a class A : > > class A: > def __init__(self): > self.n = 3 > self.m = None > def h(self, ini): > n = self.n > m = self.m >

exec behaviour

2005-11-04 Thread N. Pourcelot
Hello, I can't understand some specific behaviour of the exec statment. For example, say that I create such a class A : class A: def __init__(self): self.n = 3 self.m = None def h(self, ini): n = self.n m = self.m if ini: exec("def m(x): retu