Why doesn't Python use ^ to denote the square of a number, but uses ** instead?

Several languages ​​I've seen use a symbol ^, and it does not seem to be reserved for anything in Python. This bothers me, since the character is ^(very) well known, and Python should be easy to use, which is not so important when using **.

Is there a logical explanation for this? I mean, this is not a huge difference, but just curious for this choice?

+4
source share
3 answers

As Guido says, "The first and foremost advantage of Pythons was ABC, a language created in the early 1980s by Lambert Meertens, Leo Gürts and others at CWI." xupgraded to the level yimplemented as x**yin ABC . ABL was influenced by SETL and ALGOL 68.

+10
source

Because ^- bitwise operator XOR. This is the same for many languages, including C, C ++, C #, Java, Perl , PHP , Ruby, and, of course, others.

+9
source

FORTRAN - , ** . Python, C, , , BDFL.

+3

Source: https://habr.com/ru/post/1537583/


All Articles