On Mon, Oct 22, 2018 at 3:29 AM Andreas Winschu <andrej.w...@gmail.com> wrote:
>
> A def function has to be named.
>
> Wheres a lambda expression can be passed anonymously to any other function as 
> an argument.
>
> map(lambda x: x**2, array)
>
> vs
>
> def powers2(x)
>    x**2
> map(powers2, array)
>
> Coming up with a name here is not needed, as the operation is expressive 
> enough.
>

Sure, but can you give examples where you can't use lambda, but still
want it to have no name? Then show what your proposed syntax is, and
how it would improve the code.

Side point: I hardly ever use map with lambda functions in Python.
I'll use map with an existing function (eg "map(int, list_of_strings)"
to intify everything), but otherwise, I'll use a comprehension.
Comprehensions are also restricted to expressions only, but your
proposal won't help them.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to