Re: Confusion about __call__ and attribute lookup

2005-11-13 Thread John J. Lee
Kent Johnson [EMAIL PROTECTED] writes: Leif K-Brooks wrote: New-style classes look up special methods on the class, not on the instance: For my future reference, is this documented somewhere in the standard docs? Maybe somewhere in here :-( http://www.python.org/doc/newstyle.html John

Re: Confusion about __call__ and attribute lookup

2005-11-13 Thread Serge Orlov
Kent Johnson wrote: Leif K-Brooks wrote: New-style classes look up special methods on the class, not on the instance: For my future reference, is this documented somewhere in the standard docs? Looks like it's the most detailed explanation on the net:

Re: Confusion about __call__ and attribute lookup

2005-11-13 Thread Kent Johnson
John J. Lee wrote: Kent Johnson [EMAIL PROTECTED] writes: Leif K-Brooks wrote: New-style classes look up special methods on the class, not on the instance: For my future reference, is this documented somewhere in the standard docs? Maybe somewhere in here :-(

Confusion about __call__ and attribute lookup

2005-11-10 Thread Kent Johnson
I am learning about metaclasses and there is something that confuses me. I understand that if I define a __call__ method for a class, then instances of the class become callable using function syntax: class Foo(object): ... def __call__(self): ... print 'Called Foo' ... f=Foo()

Re: Confusion about __call__ and attribute lookup

2005-11-10 Thread Leif K-Brooks
Kent Johnson wrote: But why doesn't Foo.__call__ shadow type.__call__? Normally an instance attribute takes precedence over a class attribute. Is it something special about how function call syntax is handled internally, or do all special methods work this way, or is there something else going

Re: Confusion about __call__ and attribute lookup

2005-11-10 Thread Kent Johnson
Leif K-Brooks wrote: New-style classes look up special methods on the class, not on the instance: For my future reference, is this documented somewhere in the standard docs? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list