[issue18472] PEP 8 updates - internal interfaces and import *

Terry J. Reedy report at bugs.python.org
Wed Jul 17 00:23:47 CEST 2013


Terry J. Reedy added the comment:

Is the scope of this issue just what is in the title, the whole PEP, or something in between;-?

For instance, Guido once approved (on pydev) adding an admonition to Programming Recommendations something like the following.

* Use a def statement instead of an assignment with a lambda expression.
Yes:
def f(x): return 2*x
No:
f = lambda s: 2*x
The (only) difference between these is that the name attribute of the resulting function object is specifically 'f' instead of the generic '<lambda>'. This is more useful for tracebacks and string representations in general.

The entry could point out that a separate statement that binds the function to a name negates the two reasons that justify using lambda, but that is probably unnecessary.

This is from a discussion at least 2 years ago, perhaps 3 or more, before I would have been comfortable or perhaps even eligible to push a patch, and no one else picked up on it either.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18472>
_______________________________________


More information about the Python-bugs-list mailing list