mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-45636: Merge all numeric operators (GH-29482)
This commit is contained in:
parent
1cbaa505d0
commit
9178f533ff
16 changed files with 613 additions and 1081 deletions
|
@ -406,156 +406,29 @@ result back on the stack.
|
|||
.. versionadded:: 3.5
|
||||
|
||||
|
||||
**Binary operations**
|
||||
**Binary and in-place operations**
|
||||
|
||||
Binary operations remove the top of the stack (TOS) and the second top-most
|
||||
stack item (TOS1) from the stack. They perform the operation, and put the
|
||||
result back on the stack.
|
||||
|
||||
.. opcode:: BINARY_POWER
|
||||
|
||||
Implements ``TOS = TOS1 ** TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_MULTIPLY
|
||||
|
||||
Implements ``TOS = TOS1 * TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_MATRIX_MULTIPLY
|
||||
|
||||
Implements ``TOS = TOS1 @ TOS``.
|
||||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
|
||||
.. opcode:: BINARY_FLOOR_DIVIDE
|
||||
|
||||
Implements ``TOS = TOS1 // TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_TRUE_DIVIDE
|
||||
|
||||
Implements ``TOS = TOS1 / TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_MODULO
|
||||
|
||||
Implements ``TOS = TOS1 % TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_ADD
|
||||
|
||||
Implements ``TOS = TOS1 + TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_SUBTRACT
|
||||
|
||||
Implements ``TOS = TOS1 - TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_SUBSCR
|
||||
|
||||
Implements ``TOS = TOS1[TOS]``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_LSHIFT
|
||||
|
||||
Implements ``TOS = TOS1 << TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_RSHIFT
|
||||
|
||||
Implements ``TOS = TOS1 >> TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_AND
|
||||
|
||||
Implements ``TOS = TOS1 & TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_XOR
|
||||
|
||||
Implements ``TOS = TOS1 ^ TOS``.
|
||||
|
||||
|
||||
.. opcode:: BINARY_OR
|
||||
|
||||
Implements ``TOS = TOS1 | TOS``.
|
||||
|
||||
|
||||
**In-place operations**
|
||||
|
||||
In-place operations are like binary operations, in that they remove TOS and
|
||||
TOS1, and push the result back on the stack, but the operation is done in-place
|
||||
when TOS1 supports it, and the resulting TOS may be (but does not have to be)
|
||||
the original TOS1.
|
||||
|
||||
.. opcode:: INPLACE_POWER
|
||||
|
||||
Implements in-place ``TOS = TOS1 ** TOS``.
|
||||
.. opcode:: BINARY_OP (op)
|
||||
|
||||
Implements the binary and in-place operators (depending on the value of
|
||||
*op*).
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. opcode:: INPLACE_MULTIPLY
|
||||
.. opcode:: BINARY_SUBSCR
|
||||
|
||||
Implements in-place ``TOS = TOS1 * TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_MATRIX_MULTIPLY
|
||||
|
||||
Implements in-place ``TOS = TOS1 @ TOS``.
|
||||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
|
||||
.. opcode:: INPLACE_FLOOR_DIVIDE
|
||||
|
||||
Implements in-place ``TOS = TOS1 // TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_TRUE_DIVIDE
|
||||
|
||||
Implements in-place ``TOS = TOS1 / TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_MODULO
|
||||
|
||||
Implements in-place ``TOS = TOS1 % TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_ADD
|
||||
|
||||
Implements in-place ``TOS = TOS1 + TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_SUBTRACT
|
||||
|
||||
Implements in-place ``TOS = TOS1 - TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_LSHIFT
|
||||
|
||||
Implements in-place ``TOS = TOS1 << TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_RSHIFT
|
||||
|
||||
Implements in-place ``TOS = TOS1 >> TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_AND
|
||||
|
||||
Implements in-place ``TOS = TOS1 & TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_XOR
|
||||
|
||||
Implements in-place ``TOS = TOS1 ^ TOS``.
|
||||
|
||||
|
||||
.. opcode:: INPLACE_OR
|
||||
|
||||
Implements in-place ``TOS = TOS1 | TOS``.
|
||||
Implements ``TOS = TOS1[TOS]``.
|
||||
|
||||
|
||||
.. opcode:: STORE_SUBSCR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue