[Python-ideas] Make partial a built-in

Chris Angelico rosuav at gmail.com
Tue Sep 20 04:17:15 EDT 2016


On Tue, Sep 20, 2016 at 6:09 PM, אלעזר <elazarg at gmail.com> wrote:
> 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" ()
>

Python has a rule that syntax shouldn't look like grit on Tim's
screen. In this case, it looks like the *absence of* grit, which is
even worse :) You're giving meaning to the abuttal of two tokens, the
first of which must be callable but the second can be anything. And it
creates the scary situation of giving valid-but-useless meaning to
something all too common in Py2 code:

print "hello"

This would now create a function that, if called, would print "hello",
but then abandons it without a second thought. So it'd work in 2.7,
fail with an opaque error in 3.3, fail with a more informative error
in 3.5, and silently do nothing in 3.7. No thank you! :)

ChrisA


More information about the Python-ideas mailing list