On 06.07.2018 7:02, Chris Angelico wrote:
```On Fri, Jul 6, 2018 at 12:48 PM, Alexander Belopolsky
<alexander.belopolsky@gmail.com> wrote:
```
```Python really has a strong C legacy and this is the area where I agree that
C designers made a mistake by picking a symmetric symbol (=) for an
asymmetric operation. On top of that, they picked an asymmetric digraph (!=)
for a symmetric operation as well and Python (unfortunately) followed the
crowd and ditched a much better alternative (<>).  My only hope is that
Python 4.0 will allow ← to be used in place of either = or :=. :-)
```
```Interesting. Looking over Python's binary operators, we have:

|, ^, &, +, *: symmetric (on ints)
-, /, //, **: asymmetric
<, >: mirrored operations
<=, >=: mirrored operations but not reflected
<<, >>: non-mirrored asymmetric
and, or: technically asymmetric but often treated as symmetric
in, not in: asymmetric
is, is not: symmetric

Which ones ought to have symmetric symbols, in an ideal world? Should
<= and >= be proper mirrors of each other? Are << and >> confusing? Is
it a problem that the ** operator is most decidedly asymmetric?

Personally, I'm very happy that the operators use the same symbols
that they do in other languages - U+002B PLUS SIGN means addition, for
instance - and everything else is secondary. But maybe this is one of
those "hidden elegances" that you're generally not *consciously* aware
of, but which makes things "feel right", like how Disney's "Moana" has
freedom to the right of the screen and duty to the left. Are there
languages where symmetric operations are always represented with
symmetric symbols and vice versa?
```

Nothing like that.
The connotations for the symbols rather draw from other fields that we're familiar with.

Primarily math (that everyone has studied at school -- this is also the reason why we use infix notation even though the postfix one allows to ditch braces);
in particular, % draws from ÷ (division sign), / from fraction sign;
& is from English;
!, | and ^ are a mash from "the closest unused symbols on keyboard" to symbols from logic algebra:
¬  (https://en.wikipedia.org/wiki/Negation),${\displaystyle \lor }$
∨ (https://en.wikipedia.org/wiki/Logical_disjunction),

↑ or | (https://en.wikipedia.org/wiki/Sheffer_stroke),
↓ (https://en.wikipedia.org/wiki/Peirce's_arrow);

"!=" reads literally "not equal" ( ! is "not", = is "equal" )
(while "<>" reads "less or greater" which is mathematically not equivalent to that: not everything has a defined ordering relation. "<>" draws from BASIC AFAIK which was geared towards regular users who don't deal with advanced mathematics.)

```ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru
```