[Python-ideas] Quick idea: defining variables from functions that take the variable name
Steven D'Aprano
steve at pearwood.info
Wed Jun 1 14:35:23 EDT 2016
On Wed, Jun 01, 2016 at 12:52:58AM +0000, Michael Selik wrote:
> You brought up decorators as an example, but I think that was more about
> how decorators tend to be used essentially as part of the function
> definition. They might dramatically alter the behavior of the function and
> yet appear as an afterthought without the decorator syntax. From the PEP
> 318, "This becomes less readable with longer [functions]". The motivation
> said nothing about avoiding typing the function name twice.
Three times, not twice, and the PEP does mention it, right at the
beginning:
"It also seems less than pythonic to name the function three times for
what is conceptually a single declaration."
https://www.python.org/dev/peps/pep-0318/#motivation
--
Steve
More information about the Python-ideas
mailing list