Re: newbie: class and __dict__ variable.

2010-09-20 Thread Terry Reedy
On 9/20/2010 5:51 AM, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: If the class has a .__setattr__ method, the first bypasses that method, It also bypasses object.__setattribute__ and - as a consequence - any binding descr

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: If the class has a .__setattr__ method, the first bypasses that method, It also bypasses object.__setattribute__ and - as a consequence - any binding descriptor by the same name as the attribute being set.

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: >> If the class has a .__setattr__ method, the first bypasses that method, > > It also bypasses object.__setattribute__ and - as a consequence - any > binding descriptor by the same name as the attribute being set. __setattribute__ ?

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Bruno Desthuilliers
Terry Reedy a écrit : On 9/19/2010 1:37 PM, mafeu...@gmail.com wrote: Hallo Group Members. From time to time I see in python code following notation that (as I believe) extends namespace of MyClass. No, it does not affect MyClass, just the instance dict. class MyClass: def __init__(sel

Re: newbie: class and __dict__ variable.

2010-09-20 Thread mafeusek
Terry, thank You very much for Your answer. Very helpfull! > Have you seen exactly this usage? NO, i just wrote an example, but the trick is quite frequent, thus it will be easy to check out the existence of .__setattr__ in such a case. best regards, Pawel -- http://mail.python.org/mailman/list

Re: newbie: class and __dict__ variable.

2010-09-19 Thread Terry Reedy
On 9/19/2010 1:37 PM, mafeu...@gmail.com wrote: Hallo Group Members. From time to time I see in python code following notation that (as I believe) extends namespace of MyClass. No, it does not affect MyClass, just the instance dict. class MyClass: def __init__(self): self.__dic

newbie: class and __dict__ variable.

2010-09-19 Thread mafeusek
Hallo Group Members. From time to time I see in python code following notation that (as I believe) extends namespace of MyClass. class MyClass: def __init__(self): self.__dict__["maci"]=45 myCl2 = MyClass2() print myCl2.maci I am guessing that there must be some difference between t