[New-bugs-announce] [issue18648] FP Howto and the PEP 8 lambda guildline

Terry J. Reedy report at bugs.python.org
Sat Aug 3 22:58:16 CEST 2013

New submission from Terry J. Reedy:

Functional Programming HowTo, near the end, has a section
Small functions and the lambda expression

To illustrate, it starts with
  adder = lambda x, y: x+y
  print_assign = lambda name, value: name + '=' + str(value)
which are now proscribed by PEP 8. "Always use a def statement instead of an assignment statement that binds a lambda expression directly to a name."

The text goes on to give the def equivalents and to discourage lambdas. "Which alternative is preferable? That’s a style question; my usual course is to avoid using lambda." But I think the section should instead start with lambda examples that would be acceptable in the stdlib.

messages: 194301
nosy: akuchling, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: FP Howto and the PEP 8 lambda guildline
versions: Python 2.7, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list