On Tue, Sep 20, 2016 at 09:56:48AM +0000, אלעזר wrote:
> foo.__call__.partial() solves most of the problem I think.

There are two problems with that, one obvious and one subtle.

The obvious one is that __call__ is a dunder method, which means that 
accessing it directly from outside of the object's class is a code 
smell. It's not necessarily *wrong*, but its a bit... smelly. A bit 
suspicious. Something we should think *very* carefully about before 

The subtle one is that foo.__call__ may not actually be the method that 
is used when you call foo().

py> class X(object):
...     def __call__(self):
...             return "from X"
py> x = X()
py> x.__call__ = lambda: "surprise!"
py> x()
'from X'
py> x.__call__()

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to