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

Nick Coghlan ncoghlan at gmail.com
Sat Apr 2 01:29:19 EDT 2016


On 2 April 2016 at 00:36, Alexander Walters <tritium-list at sdamon.com> wrote:
> I said earlier that if this suggestion was made in 1991 it should have been
> accepted to make functions more consistent with classes.  I have changed my
> mind; in 1991 classes should have been corrected to always require parens.

In fact, the one change made in this area since then was to *permit*
empty parens on class definitions back in Python 2.5:
https://hg.python.org/cpython/rev/a0d3f773543d

Prior to that, the empty parens were mandatory for functions and
explicitly disallowed for classes. Making them mandatory for classes
would break too much code for not enough benefit, while making them
optional for functions would introduce an additional stylistic choice
with no demonstrable benefit to code maintainability, and a clear
disadvantage in creating a new opportunity for style inconsistencies.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list