[Python-ideas] Make parenthesis optional in parameterless functions definitions
Sven R. Kunze
srkunze at mail.de
Fri Apr 1 05:25:24 EDT 2016
On 01.04.2016 02:43, Steven D'Aprano wrote:
> (where the parameter-list might have one parameter, or ten, or zero).
> With your proposal the reader will *nearly always* see the consistent
> pattern:
>
> def name ( parameter-list ) :
>
> but very occasionally, maybe one time in a hundred functions, or a
> thousand, see:
>
> def name :
>
> and be surprised. Even if it is just for a millisecond, that doesn't
> help readability, it hurts it.
I disagree.
I remember this "issue" with decorators as well.
@property
def foo....
@lru_cache() # really?
def bar...
All decorators created with context_manager have this behavior. The
proposal is about removing () for function definitions, so this differs.
However, decorators have a very declarative style as do function
definitions. So what do those special characters serve?
IMHO It's just visual clutter.
Best,
Sven
More information about the Python-ideas
mailing list