
On 01/31/2013 09:15 AM, MRAB wrote:
On 2013-01-31 16:35, Jason Keene wrote:
Why do function definitions require parens?
class MyClass: ... pass ... def my_func: File "<stdin>", line 1 def my_func: ^ SyntaxError: invalid syntax
This seems to me to break a symmetry with class definitions. I assume this is just a hold off from C, perhaps there is a non-historical reason tho.
The parentheses are always required when calling the function, so it makes sense to always require them when defining the function.
The case with class definitions is different; they are used in the definition only when you want to specify the superclass.
... they are required in the definition when you want to specify the superclass, and optional otherwise. ~Ethan~