[Python-ideas] Make parenthesis optional in parameterless functions definitions

Terry Reedy tjreedy at udel.edu
Fri Apr 1 05:52:31 EDT 2016


On 4/1/2016 5:25 AM, Sven R. Kunze wrote:

> I remember this "issue" with decorators as well.
>
> @property
> def foo....
>
> @lru_cache()    # really?
> def bar...

There is a sematic difference between the two examples. The ()s are not 
optional. 'property' is a decorator that is applied to foo after it is 
defined.  'lru_cache()' is a function call that returns a decorator. 
Quite different.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list