[Python-ideas] Repr of lambda
storchaka at gmail.com
Mon Dec 18 03:49:54 EST 2017
17.12.17 22:55, Terry Reedy пише:
>> What if include the signature and the expression of the lambda in its
>> >>> lambda x: x**2
>> <lambda x: x**2>
> Printing the return value requires adding a code or function attribute.
Yes, this requires adding an optional constant code attribute.
> The return expression(s), possibly None, would be just as useful for
> named functions.
In case of named functions the body is not an expression and usually is
>> But there is a problem with default values. Their reprs can be very
>> long, especially in the following case with mutable default value:
> I would not expect the representation to change; just use the expression.
This is a solution, thanks.
>> Maybe the placeholder should be always used instead of default values.
> Do you mean 'a placeholder'?
More information about the Python-ideas