On 27/03/19 09:21, Alexey Muranov wrote:
> Whey you need a simple function in Python, there is a choice between a
> normal function declaration and an assignment of a anonymous function
> (defined by a lambda-expression) to a variable:
>
>    def f(x): return x*x
>
> or
>
>    f = lambda x: x*x
>
> It would be however more convenient to be able to write instead just
>
>    f(x) = x*x
>
> (like in Haskell and such).
>
> Have this idea been discussed before?
>
> I do not see any conflicts with the existing syntax.   The following
> would also work:

I don't know. Something like the following is already legal:

f(x)[n] = x * n

And it does something completly different.

-- 
Antoon Pardon.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to