[Python-ideas] Light-weight call-by-name syntax in Python
Nathaniel Smith
njs at pobox.com
Sat Feb 18 05:55:32 EST 2017
On Fri, Feb 17, 2017 at 2:46 AM, Stephan Houben <stephanh42 at gmail.com> wrote:
> Hi Nathaniel,
>
>
> 2017-02-17 11:28 GMT+01:00 Nathaniel Smith <njs at pobox.com>:
>>
>> Note that this is definitely a different proposal from the original,
>> since the original proposer's goal was to be able to use this with
>> existing, unmodified functions that expect a regular value, not a
>> lambda.
>>
>> I don't really see how that goal can be accomplished without massively
>> revising Python's runtime model, so this doesn't really bother me, but
>> it should be noted :-).
>
>
> Yep ;-)
>
>>
>>
>> Anyway, you might also be interested in:
>>
>>
>> https://mail.python.org/pipermail/python-ideas/2016-November/043590.html
>>
>> which is a similar idea and some more motivating examples, except that
>> it allows for the full richness of Python's call syntax, and passes
>> ASTs rather than lambdas to allow for non-standard evaluation rules.
>>
>
> Frankly, I think that proposal is too baroque.
> The simplicity of my proposal is intentional.
I feel like using Python's existing call syntax is less baroque then
inventing a new, redundant call syntax that doesn't look like anything
else in the language, but I suppose tastes will differ :-).
> Just passing in a callable makes it simpler and makes it
> also more likely that existing functions could be used with it.
This is also potentially a downside, though... the macro-call proposal
not only handles the cases you're worrying about, but also handles a
bunch of cases that are basically impossible to handle in Python right
now. OTOH all the cases where your proposal is useful are ones that
Python can already handle at the cost of adding 6 characters. That's
not a terribly compelling argument for violating TOOWTDI, IMO.
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the Python-ideas
mailing list