On Sat, Mar 9, 2019 at 4:14 PM Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
>
> A large part of the reason that common operations are written
> using infix operators is that the operator symbols used are very
> compact. That benefit disappears if your operator is an entire
> word.

I suppose people bring up Haskell too much, but it does work in
Haskell. People write things like (item `notElem` list) all the time
and it's readable enough.

In Haskell, though, it's sugar for (notElem item list), or
notElem(item, list) in Pythonish syntax. In Python, it'd in most cases
be sugar for a method call, in which the method name already appears
in infix position, so the benefit is less clear.

Given that Python's so-called augmented assignments are really
mutating operations in disguise anyway (x op= y is not equivalent to x
= x op y when x is mutable), I don't see any advantage of a new
assignment syntax over the existing mutating methods. I.e., instead of
x @update= y, you can just write x.update(y).
_______________________________________________
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