Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-10 Thread Bruno Desthuilliers
samwyse a écrit : On Jul 8, 4:56 pm, Joseph Barillari <[EMAIL PROTECTED]> wrote: My question is: did something about the way the special method names are implemented change for new-style classes? Just off the top of my head, I'd guess that it's due to classes already having a default __call__

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-10 Thread Steven D'Aprano
On Tue, 08 Jul 2008 17:56:45 -0400, Joseph Barillari wrote: > Hi python-list, > > I've just started using new-style classes and am a bit confused as to > why I can't seem to alter methods with special names (__call__, etc.) of > new-style class instances. [deploy weapon of mass snippage] Here i

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread Terry Reedy
samwyse wrote: On Jul 8, 4:56 pm, Joseph Barillari <[EMAIL PROTECTED]> wrote: My question is: did something about the way the special method names are implemented change for new-style classes? I believe the difference is that for new-style classes, when special methods are called 'behind t

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread samwyse
On Jul 8, 4:56 pm, Joseph Barillari <[EMAIL PROTECTED]> wrote: > My question is: did something about the way the special method names are > implemented change for new-style classes? Just off the top of my head, I'd guess that it's due to classes already having a default __call__ method, used when

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread cokofreedom
> > My question is: did something about the way the special method names are > implemented change for new-style classes? > >>> class old: pass >>> class new(object): pass >>> testone = old() >>> testone.__call__ = lambda : 33 >>> testone() 33 >>> testtwo = new() >>> testtwo.__cal

Impossible to change methods with special names of instances of new-style classes?

2008-07-08 Thread Joseph Barillari
Hi python-list, I've just started using new-style classes and am a bit confused as to why I can't seem to alter methods with special names (__call__, etc.) of new-style class instances. In other words, I can do this: >>> class Z: ... pass ... >>> z = Z() >>> z.__call__ = lambda : 33 >>> z() 3