[Python-ideas] Multi Statement Lambdas
Steven D'Aprano
steve at pearwood.info
Sun Oct 21 18:52:31 EDT 2018
On Sun, Oct 21, 2018 at 06:28:40PM +0200, Andreas Winschu wrote:
> A def function has to be named.
That's a feature, not a lack.
As a general rule of thumb, if the body of a function is complex enough
to require multiple statements, it is probably complex enough to require
documentation, testing and a nice name to display in tracebacks.
I wish that somebody would do an objective scientific study on the bug
density of code using named functions versus anonymous code blocks. My
intuition (which is, of course, completely subjective) tells me that
code written in languages that allow and encourage anonymous code blocks
will have more bugs, simply because coders will be less likely to name
and test their functions.
--
Steve
More information about the Python-ideas
mailing list