[Python-ideas] Make partial a built-in
Chris Angelico
rosuav at gmail.com
Tue Sep 20 03:53:39 EDT 2016
On Tue, Sep 20, 2016 at 5:01 PM, אלעזר <elazarg at gmail.com> wrote:
> But the foo() finds the function to call, so foo.bind() could be made to
> find it too.
class Demo:
def __init__(self):
self.bind = 42
def __call__(self):
print("I got called!")
foo = Demo()
You can most certainly call foo(), but foo.bind() will bite you.
With a stand-alone function bind(foo), it can use protocols like __call__.
ChrisA
More information about the Python-ideas
mailing list