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

Alexander Walters tritium-list at sdamon.com
Thu Mar 31 13:30:47 EDT 2016


While it would be consistent, and if you suggested it in 1991 probably 
should have been included... are the two extra keystrokes really a problem?

On 3/31/2016 12:29, Mahan Marwat wrote:
>
> ---------- Forwarded message ----------
> From: *Mahan Marwat* <mahanmarwat at gmail.com 
> <mailto:mahanmarwat at gmail.com>>
> Date: Thu, Mar 31, 2016 at 9:09 PM
> Subject: Make parenthesis optional in parameterless functions definitions
> To: python-ideas at python.org <mailto:python-ideas at python.org>
>
>
> Hi,
>
> I have an idea of making parenthesis optional for functions having no 
> parameters. i.e
>
> def greet: # note the missing parenthesis
>     print('hello')
>
> The less awkward characters we have, the more readable our code will 
> be (Beautiful is better then ugly). Some people argued that function 
> definition with parenthesis seems to them natural. But actually it 
> seems to us natural, because we have been used to it a-lot. IMHO 
> parenthesisless functions definitions are natural and readable.
>
> In Python we have already adopted this. i.e parenthesis are optional 
> in `if` statements, in class definition, in tuple etc
>
> if x == 1: # parenthesis are optional here
>     pass
>
> class Greet: # now we don't explicitly inherit from `object`
>     pass
>
> Tuple = 1, 2, 3 # parenthesis are optional here too
>
> Please, give your opinion.
>
> Thanks, Adnan Khan
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160331/0adb2686/attachment-0001.html>


More information about the Python-ideas mailing list