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

Sven R. Kunze srkunze at mail.de
Thu Mar 31 12:47:53 EDT 2016


On 31.03.2016 18: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.

+1


[side-note: although I admit that it would not change much where we 
work. We mostly use classes and there you need to have "self" as minimum 
parameter. But the idea is actually quite nice.]


Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160331/ff82e454/attachment.html>


More information about the Python-ideas mailing list