[Python-ideas] Fwd: Make parenthesis optional in parameterless functions definitions
Mahan Marwat
mahanmarwat at gmail.com
Thu Mar 31 12:29:36 EDT 2016
---------- Forwarded message ----------
From: Mahan Marwat <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
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160331/9d5dab25/attachment.html>
More information about the Python-ideas
mailing list