[Python-Dev] PEP 8 modernisation
steve at pearwood.info
Sun Aug 4 04:44:51 CEST 2013
On 02/08/13 06:52, Alexander Belopolsky wrote:
> On Thu, Aug 1, 2013 at 4:29 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> def f(x): return 2*x
>> f = lambda x: 2*x
> Am I the only one who finds the second line above much more readable than
> the first? The def statement is not intended to be written in one line.
> The readability suffers because the argument is separated from the value
> expression by return keyword.
You are not the only one.
I will continue to write "f = lambda ..." at the interactive interpreter without shame, although I rarely (never?) use it in code.
More information about the Python-Dev