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

Sven R. Kunze srkunze at mail.de
Fri Apr 1 06:10:52 EDT 2016


On 01.04.2016 11:52, Terry Reedy wrote:
> 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
Thanks for snipping away the relevant explanation and not addressing my 
point. >.<

@others
Never said it were optional. Decorating and function definitions have a 
declarative style in common. The point was that these () don't serve 
anything in case of declarations.


Best,
Sven


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160401/b376f6d1/attachment.html>


More information about the Python-ideas mailing list