In a way they do the same thing, they both create an object (function/class) from a suite and assign it to the name given after the keyword (def/class).  Sure they do totally different things with the suite in creating the object, but in essence it's a name assignment.

On Thursday, January 31, 2013, Steven D'Aprano wrote:
On 01/02/13 03: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.

Why do you think that class definitions and function definitions
should be symmetrical?

Python-ideas mailing list