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

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Feb 12 23:41:06 CET 2011


Géza wrote:

> def result=functionname(params):
>       ...
>       result=something

This doesn't seem to be a great improvement over

   def functionname(params):
     ...
     result = something
     ...
     return result

About the only one of your points it doesn't cover is returning
from the middle of the function without an explicit value, which
many people would regard as bad style anyway.

> - It is very easy to write the function call prototype: just copy the 
> function declaration without the "def" and final colon.

And delete any 'self' argument, default values, annotations,
* and ** arguments, etc. etc. just as you have to do today...

-- 
Greg



More information about the Python-ideas mailing list