# [Python-ideas] The \$update operator for dictionaries

Jonathan Fine jfine2358 at gmail.com
Sat Mar 9 16:47:13 EST 2019

```A good starting point for discussing the main idea is:
PEP 465 -- A dedicated infix operator for matrix multiplication
https://www.python.org/dev/peps/pep-0465

Matrix multiplication is one of many special binary mathematical
operators. PEP 465 successfully argues the merits of introducing a
special operator for matrix multiplication. This thread starts from a
discussion of the merits of binding dict.update to an operator. (For
update, '+', '|' and '<<' the leading candidate symbols.)

Matrices and linear algebra are not the only part of mathematics that
is usually expressed with infix operators. Thus, I suggest that the
main questions are:

1. In practice, how important are additional infix operators to the
Python community?
2. Can we harmoniously extend Python to accommodate these new operators?

Here, from PEP 465, are some highlights of the benefits.

<quote>
Infix @ dramatically improves matrix code usability at all stages of
programmer interaction.

A large proportion of scientific code is written by people who are
experts in their domain, but are not experts in programming.

For these kinds of users, whose programming knowledge is fragile, the
existence of a transparent mapping between formulas and code often
means the difference between succeeding and failing to write that code
at all.
</endquote>

Most mathematical and scientific formulas can be written in LaTeX
notation, which gives standard names for the infix operators
mathematicians use.

There is no transparent and obvious mapping from the present operators
to those used in mathematics.
https://docs.python.org/3/reference/lexical_analysis.html?#operators

Using Unicode symbols for the math operators is probably unwise.
Better, I suggest, is to use the LaTeX names.

There is some evidence (the wish to bind dict.update to an infix
operator) that outside of mathematics there is a demand for custom
infix operators.

--
Jonathan
```

More information about the Python-ideas mailing list