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

Terry Reedy tjreedy at udel.edu
Fri Apr 1 15:31:59 EDT 2016

On 4/1/2016 7:49 AM, Michel Desmoulin wrote:

> Yes, and because after more than a decade of Python, I still forget to
> type out the parenthesis some time,

Only in function definitions, or also in function calls.

  then go back and realize that it's
> silly that I have to since I don't with classes.

The parallel in invalid.  To repeat what I said in the my initial 
response and what others have said: the header in a def statement shows 
now to call the function (the signature).  The header in a class 
statement does no such thing.  The () in a def statement represent the 
call operator.  The () is a class statement do not.  There serve a 
visual grouping and subordination purpose.  "class mystring(str)" does 
not say anything about how to use mystring as a callable.

> Is there really a strong case against it

Yes, as has been presented before, but ignored by proponents.  For one: 
I believe that omitting () in def will encourage people to even more 
ofter omit () in calls, when needed, and that is BAD.  I consider this a 
killer argument against it.

 > than just "it's not pure" ?

I have seen this too often.  Practical arguments against a proposal are 
either ignored or wrongly dismissed as 'purity arguments'.  To me, this 
makes the discussion useless.

Terry Jan Reedy

More information about the Python-ideas mailing list