Syntax for one-line "nonymous" functions in "declaration style"

Alexey Muranov alexey.muranov at gmail.com
Thu Mar 28 16:21:48 EDT 2019


On jeu., mars 28, 2019 at 8:57 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 
>> But i see your point about never assigning lambdas directly, it 
>> makes sense.  But sometimes i do assign short lambdas directly to 
>> variable.
>> 
>>> Is the convenience and (very low) frequency of applicability worth 
>>> the inconvenience of confusing the meaning of '=' and 
>>> complicating the implementation?
>>> 
>>>> I do not see any conflicts with the existing syntax.
>>> 
>>> It heavily conflicts with existing syntax.  The current meaning of
>>>   target_expression = object_expression
>>> is
>>> 1. Evaluate object_expression in the existing namespace to an 
>>> object, prior to any new bindings and independent of the 
>>> target_expression.
>>> 2. Evaluate target_expression in the existing namespace to one or 
>>> more targets.
>>> 3. Bind object to target or iterate target to bind to multiple 
>>> targets.
>> 
>> I do not thick so.  In "x = 42" the variable x is not evaluated.
>> 
>> All examples of the proposed syntax i can think of are currently 
>> illegal, so i suppose there is no conflicts. (I would appreciate a 
>> counterexample, if any.)
> 
> You are talking about syntax conflicts, I am talking about semantic 
> conflict, which is important for human understanding.

I believe there is no semantic conflict either, or could you be more 
specific?

Alexey.





More information about the Python-list mailing list