Can't define __call__ within __init__?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Mar 11 22:24:39 EST 2010
On Thu, 11 Mar 2010 08:20:14 -0800, Steve Howell wrote:
>> (2) special methods like __call__ are only called on the class, not the
>> instance, so you can't give each instance its own method.
>>
>>
> Are you sure about that? This program prints 1, 2, 1, 2.
The rules for classic classes are different. Since classic classes have
gone away in 3.0, and are becoming rarer in 2.x, I didn't bother to
mention the complication.
--
Steven
More information about the Python-list
mailing list