On Tue, Sep 20, 2016 at 10:54 AM Chris Angelico
On Tue, Sep 20, 2016 at 5:01 PM, אלעזר
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__.
I meant something like making it a "__bind__" (just a strawman suggestion) and do the same lookup as foo() does, and using a (wrong) functional-programming-inspired syntax
foo 5 () Such a syntax will have the side benefit of allowing calling print in a similar way to Python2, which people seem to love. print "hello" () This strawman proposal has many downsides I guess. My point being, this can be made to work, but it's probably not worth it. Elazar