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

Sven R. Kunze srkunze at mail.de
Thu Mar 31 16:49:47 EDT 2016


On 31.03.2016 20:06, Terry Reedy wrote:
>
>> def greet: # note the missing parenthesis
>>      print('hello')
>
> -1  This will lead people to think even more often than they do now 
> that they can omit () in the call.

Interesting that you mentioned it. Doesn't Ruby handle it this way?

Let's see how this would look like in Python:


def distance of point1, point2:
     # Pythagoras

point1 = (3, 1)
point2 = (1, 4)
print distance of point1, point2


Hmmm. Although I like the lightness of this, it's somewhat confusing, isn't?


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


More information about the Python-ideas mailing list