[Python-ideas] adding possibility for declaring a function in Matlab's way

Stephen J. Turnbull stephen at xemacs.org
Sat Feb 12 07:42:41 CET 2011


Géza writes:

 > Some advantages:
 > - You can easily see what the function returns, without having to read the 
 > function body, or hoping to find it in the comments.

This is probably true in Matlab, and *if* the programmer gives it a
good name.  But many programmers will care more about saving (len
variable-name) keystrokes that about giving good names, so you will
literally see

def result = foo (**args):
    # code goes here

So, is result a list?  A function?  An instance of some class?  Maybe
it's polymorphic.

-1 overall; the syntax we have already is readable enough.

Also, some of the things you might want to use this for probably can
be done with decoraters.







More information about the Python-ideas mailing list