On 11/07/2014 10:50 PM, dieter wrote:
Ethan Furman <et...@stoneleaf.us> writes:
On 11/06/2014 10:59 PM, dieter wrote:
John Ladasky writes:
On Tuesday, November 4, 2014 11:12:31 AM UTC-8, Ethan Furman wrote:
If you really absolutely positively have to have the signature be correct for
each instance, you may to either look at a
function creating factory, a class creating factory, or a meta-class.
+1. Overriding __call__() within the class definition, over and over again,
with different function, looks awkward to me.
A possibility to get the original approach implemented looks like:
make "__call__" a descriptor on the class which looks up the real
method on the instance.
This still wouldn't get the signatrue correct, though.
Why not? Once the descriptor is resolved, you get the final
instance method - with the correct signature.
Hmmm... well, it wouldn't be correct on a class lookup, but, yeah, it would be correct for an instance lookup -- and
maybe that's good enough for the OP.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list