[Python-ideas] Syntactic sugar to declare partial functions

Jacco van Dorp j.van.dorp at deonet.nl
Fri Aug 10 02:49:43 EDT 2018


I actually really like the method-on-function-object syntax. +1, for
what it's worth from someone like me.

2018-08-10 0:46 GMT+02:00 Neil Girdhar <mistersheik at gmail.com>:
> I prefer partial since many programmers studied computer science, and also
> it makes the concepts easier to google.
>
> Anyway, I don't actually want either a partial member nor new syntax for
> this, but if I had to choose, I'd choose no new syntax.
>
> On Thu, Aug 9, 2018 at 2:32 PM Abe Dillon <abedillon at gmail.com> wrote:
>>
>> I'd like to push for the less jargon-y `func.given()` version if this
>> gains traction. Not only is it shorter, it's a much more common term with a
>> clear meaning. Words like 'partial', 'curry', 'lambda', and 'closure' are
>> fine for text books, published papers, and technical discussion, but I think
>> they would (or do in the case of 'lambda') harm Python. I know the correct
>> term for the 'if-else' expression is a 'ternary' expression, but that
>> doesn't mean Python should have used the word 'ternary' in the syntax.
>>
>> On Thu, Aug 9, 2018 at 12:14 PM, Neil Girdhar <mistersheik at gmail.com>
>> wrote:
>>>
>>> That's a nicer solution to me.
>>>
>>> On Thu, Aug 9, 2018 at 1:00 PM Michel Desmoulin
>>> <desmoulinmichel at gmail.com> wrote:
>>>>
>>>> I'd rather have functools.partial() to be added as a new method on
>>>> function objects.
>>>>
>>>> >
>>>> > fromfunctools importpartial
>>>> >
>>>> >
>>>> > def add(x:int,y:int)->int:
>>>> >     returnx +y
>>>> >
>>>> >
>>>> > add_2 = partial(add,2)
>>>> >
>>>>
>>>> Would become:
>>>>
>>>> add_2 = add.partial(2)
>>>>
>>>> Nothing to change on the parser, no obscure syntax for future readers,
>>>> and we can get the opportunity of rewriting partial() in C as right now
>>>> it is amazingly way, way slower than a lambda.
>>>> _______________________________________________
>>>> Python-ideas mailing list
>>>> Python-ideas at python.org
>>>> https://mail.python.org/mailman/listinfo/python-ideas
>>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "python-ideas" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/python-ideas/jOMinivFCcQ/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> python-ideas+unsubscribe at googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>


More information about the Python-ideas mailing list