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

Steven D'Aprano steve at pearwood.info
Fri Apr 1 09:54:46 EDT 2016

On Fri, Apr 01, 2016 at 01:49:03PM +0200, Michel Desmoulin wrote:

> There are dozen of good way to oppose an idea, just saying "we got a
> moral stand to not do it" is not convincing.

Nobody has made that argument.

> Espacially in a language
> with so many compromised like len(foo) instead of foo.len,

len(foo) isn't a compromise, it is an intentional feature.

> functional paradigme and Poo and immutability and mutability, etc.


You might not be aware that "poo" is an English euphemism for excrement, 
normally used for and by children. So I'm completely confused by what 
you mean by "and Poo".

> Python has an history of making things to get out of the way:

There are many people who would say that Python's case sensitivity and 
significant indentation "get in the way".

> - no {} for indentation;
> - optional parentheses for tuples;

No. Parentheses have nothing to do with tuples (except the empty tuple). 
Parentheses are used for *grouping*. Parens don't make tuples, and they 
aren't "optional" any more than parens are "optional" in addition 
because you can write `result = (a+b)`. The parens here have nothing to 
do with addition, and it would be misleading to say "optional 
parentheses for addition".

Writing (1, 2, 3) is similar to writing ([1, 2, 3]) or ("abc") or (123). 
Apart from nested tuples, it's almost never needed.

> - optional parenthesis for classes;

Needed for backwards compatibility. Let's not copy that misfeature into 
future misfeatures.

> If this changes does not hurt readability, ability to debug and doesn't
> make your code/program any worst than it was but does't help even a
> little, why not ?

Who says that it doesn't hurt readability? My personal experience tells 
me that it DOES hurt readability, at least a little, and adds confusion 
to the rules of what needs parens when and what doesn't.

You might not agree with my personal experience, but you shouldn't just 
dismiss it or misrepresent it as a "moral stand". My argument cuts right 
to the core of the argument that making parens optional helps -- my 
experience is that it *doesn't help*, it actually HURTS.


More information about the Python-ideas mailing list