[Python-ideas] The @update operator for dictionaries

Pål Grønås Drange paal.drange at gmail.com
Sat Mar 9 13:19:44 EST 2019

On Sat, 9 Mar 2019 at 18:22, Jonathan Fine <jfine2358 at gmail.com> wrote:
> I'm suggesting that the grammar allow us, if we wish, to write
>    c = a @cup b
> for the union of two sets. And
>    len(A @cup B) == len(A) + len(B) - len(A @cap B)

You can use the infix module for that, which allows you to write

- a @cup@ b
- a &cup& b
- a <<cup>> b
- a ^cup^ b
- a **cup** b
- a /cup/ b
- a %cup% b
- a |cup| b

Use that for a while, and if you like it, you can help the authors spread
the word.

- Pål
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190309/12fc0e05/attachment.html>

More information about the Python-ideas mailing list