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__
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
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
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
>
> 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
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