[Python-ideas] Enhance definition of functions

Matthew Lefavor mclefavor at gmail.com
Tue Jul 30 17:25:10 CEST 2013


What's wrong with the current syntax? Why can't you just write a def? I
didn't do an exact count, but it looks like the lengths of the two function
definitions differ by at most a single character.


On Tue, Jul 30, 2013 at 11:19 AM, Musical Notation <
musicdenotation at gmail.com> wrote:

> Yes, I know that multiline lambda will never be implemented in Python, but
> in many languages it is possible to write an anonymous function without
> using lambda at all.
> In JavaScript:
> Instead of "function <name>(<variables>){code}" you can write "var name;
> name=function(<variables>){code}"
> Python (proposed):
> def func(a,b):
>     print(a+b)
>     return a+b
>
>  becomes
>
> func=function a,b:
>     print(a+b)
>     return a+b
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130730/d03b0669/attachment.html>


More information about the Python-ideas mailing list