|
1468 | 1468 | \def\dunder#1{\expandafter\pythonilIdx{\_\_#1\_\_}\expandafter\pythonIdx{dunder!\_\_#1\_\_}}%
|
1469 | 1469 | %
|
1470 | 1470 | \dirtree{%
|
1471 |
| -.1 String Representation. |
1472 |
| -.2 \dunder{str}\DTcomment{returns a concise string representation for users; \pythonil{str(a)} $\equiv$ \pythonil{a.\_\_str\_\_()}}. |
1473 |
| -.2 \dunder{repr}\DTcomment{a string with all information about the object for programmers; \pythonil{repr(a)} $\equiv$ \pythonil{a.\_\_repr\_\_()}}. |
1474 |
| -.1 Hashing. |
1475 |
| -.2 \dunder{hash}\DTcomment{compute an integer value representing this object; \pythonil{hash(a)} $\equiv$ \pythonil{a.\_\_hash\_\_()}}. |
1476 |
| -.1 Ordering and Equality. |
1477 |
| -.2 \dunder{eq}\DTcomment{equality: \pythonil{a == b} $\equiv$ \pythonil{a.\_\_eq\_\_(b)}}. |
1478 |
| -.2 \dunder{ne}\DTcomment{inequality: \pythonil{a != b} $\equiv$ \pythonil{a.\_\_ne\_\_(b)}}. |
1479 |
| -.2 \dunder{lt}\DTcomment{less than: \pythonil{a < b} $\equiv$ \pythonil{a.\_\_lt\_\_(b)}}. |
1480 |
| -.2 \dunder{le}\DTcomment{less than or equal: \pythonil{a <= b} $\equiv$ \pythonil{a.\_\_le\_\_(b)}}. |
1481 |
| -.2 \dunder{gt}\DTcomment{greater than: \pythonil{a > b} $\equiv$ \pythonil{a.\_\_gt\_\_(b)}}. |
1482 |
| -.2 \dunder{ge}\DTcomment{greater than or equal: \pythonil{a >= b} $\equiv$ \pythonil{a.\_\_ge\_\_(b)}}. |
1483 |
| -.1 Context Managers. |
1484 |
| -.2 \dunder{enter}\DTcomment{enter a \pythonilIdx{with} statement, returns a value given to \pythonilIdx{as}}. |
1485 |
| -.2 \dunder{exit}\DTcomment{leave a \pythonilIdx{with} statement, receive exception information, returns~\pythonil{False} to re-raise caught exceptions, if any}. |
1486 |
| -.1 Arithmetics. |
1487 |
| -.2 \dunder{add}\DTcomment{add: \pythonil{a + b} $\equiv$ \pythonil{a.\_\_add\_\_(b)}}. |
1488 |
| -.2 \dunder{radd}\DTcomment{right-add: \pythonil{a + b} $\equiv$ \pythonil{b.\_\_radd\_\_(a)}, if \pythonil{a.\_\_add\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1489 |
| -.2 \dunder{sub}\DTcomment{subtract: \pythonil{a - b} $\equiv$ \pythonil{a.\_\_sub\_\_(b)}}. |
1490 |
| -.2 \dunder{rsub}\DTcomment{right-subtract: \pythonil{a - b} $\equiv$ \pythonil{b.\_\_rsub\_\_(a)}, if \pythonil{a.\_\_sub\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1491 |
| -.2 \dunder{mul}\DTcomment{multiply: \pythonil{a * b} $\equiv$ \pythonil{a.\_\_mul\_\_(b)}}. |
1492 |
| -.2 \dunder{rmul}\DTcomment{right-multiply: \pythonil{a * b} $\equiv$ \pythonil{b.\_\_rmul\_\_(a)}, if \pythonil{a.\_\_mul\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1493 |
| -.2 \dunder{truediv}\DTcomment{divide: \pythonil{a / b} $\equiv$ \pythonil{a.\_\_truediv\_\_(b)}}. |
1494 |
| -.2 \dunder{rtruediv}\DTcomment{right-divide: \pythonil{a / b} $\equiv$ \pythonil{b.\_\_rtruediv\_\_(a)}, if \pythonil{a.\_\_truediv\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1495 |
| -.2 \dunder{mod}\DTcomment{modulo-divide: \pythonil{a \% b} $\equiv$ \pythonil{a.\_\_mod\_\_(b)}}. |
1496 |
| -.2 \dunder{rmod}\DTcomment{right-modulo-divide: \pythonil{a \% b} $\equiv$ \pythonil{b.\_\_rmod\_\_(a)}, if \pythonil{a.\_\_mod\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1497 |
| -.2 \dunder{floordiv}\DTcomment{integer-divide: \pythonil{a // b} $\equiv$ \pythonil{a.\_\_floordiv\_\_(b)}}. |
1498 |
| -.2 \dunder{rfloordiv}\DTcomment{right-integer-divide: \pythonil{a // b} $\equiv$ \pythonil{b.\_\_rfloordiv\_\_(a)}, if \pythonil{a.\_\_floordiv\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1499 |
| -.2 \dunder{pow}\DTcomment{exponential: \pythonil{a ** b} $\equiv$ \pythonil{a.\_\_pow\_\_(b)}}. |
1500 |
| -.2 \dunder{rpow}\DTcomment{right-exponential: \pythonil{a ** b} $\equiv$ \pythonil{b.\_\_rpow\_\_(a)}, if \pythonil{a.\_\_pow\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1501 |
| -.2 \dunder{matmul}\DTcomment{matrix-multiply: \pythonil{a @ b} $\equiv$ \pythonil{a.\_\_matmul\_\_(b)}}. |
1502 |
| -.2 \dunder{rmatmul}\DTcomment{right-matrix-multiply: \pythonil{a @ b} $\equiv$ \pythonil{b.\_\_rmatmul\_\_(a)}, if \pythonil{a.\_\_matmul\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1471 | +.1 \pythonilIdx{\_\_}. |
| 1472 | +.2 String Representation. |
| 1473 | +.3 \dunder{str}\DTcomment{returns a concise string representation for users; \pythonil{str(a)} $\equiv$ \pythonil{a.\_\_str\_\_()}}. |
| 1474 | +.3 \dunder{repr}\DTcomment{a string with all information about the object for programmers; \pythonil{repr(a)} $\equiv$ \pythonil{a.\_\_repr\_\_()}}. |
| 1475 | +.2 Hashing. |
| 1476 | +.3 \dunder{hash}\DTcomment{compute an integer value representing this object; \pythonil{hash(a)} $\equiv$ \pythonil{a.\_\_hash\_\_()}}. |
| 1477 | +.2 Ordering and Equality. |
| 1478 | +.3 \dunder{eq}\DTcomment{equality: \pythonil{a == b} $\equiv$ \pythonil{a.\_\_eq\_\_(b)}}. |
| 1479 | +.3 \dunder{ne}\DTcomment{inequality: \pythonil{a != b} $\equiv$ \pythonil{a.\_\_ne\_\_(b)}}. |
| 1480 | +.3 \dunder{lt}\DTcomment{less than: \pythonil{a < b} $\equiv$ \pythonil{a.\_\_lt\_\_(b)}}. |
| 1481 | +.3 \dunder{le}\DTcomment{less than or equal: \pythonil{a <= b} $\equiv$ \pythonil{a.\_\_le\_\_(b)}}. |
| 1482 | +.3 \dunder{gt}\DTcomment{greater than: \pythonil{a > b} $\equiv$ \pythonil{a.\_\_gt\_\_(b)}}. |
| 1483 | +.3 \dunder{ge}\DTcomment{greater than or equal: \pythonil{a >= b} $\equiv$ \pythonil{a.\_\_ge\_\_(b)}}. |
| 1484 | +.2 Context Managers. |
| 1485 | +.3 \dunder{enter}\DTcomment{enter a \pythonilIdx{with} statement, returns a value given to \pythonilIdx{as}}. |
| 1486 | +.3 \dunder{exit}\DTcomment{leave a \pythonilIdx{with} statement, receive exception information, returns~\pythonil{False} to re-raise caught exceptions, if any}. |
| 1487 | +.2 Arithmetics. |
| 1488 | +.3 \dunder{add}\DTcomment{add: \pythonil{a + b} $\equiv$ \pythonil{a.\_\_add\_\_(b)}}. |
| 1489 | +.3 \dunder{radd}\DTcomment{right-add: \pythonil{a + b} $\equiv$ \pythonil{b.\_\_radd\_\_(a)}, if \pythonil{a.\_\_add\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1490 | +.3 \dunder{sub}\DTcomment{subtract: \pythonil{a - b} $\equiv$ \pythonil{a.\_\_sub\_\_(b)}}. |
| 1491 | +.3 \dunder{rsub}\DTcomment{right-subtract: \pythonil{a - b} $\equiv$ \pythonil{b.\_\_rsub\_\_(a)}, if \pythonil{a.\_\_sub\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1492 | +.3 \dunder{mul}\DTcomment{multiply: \pythonil{a * b} $\equiv$ \pythonil{a.\_\_mul\_\_(b)}}. |
| 1493 | +.3 \dunder{rmul}\DTcomment{right-multiply: \pythonil{a * b} $\equiv$ \pythonil{b.\_\_rmul\_\_(a)}, if \pythonil{a.\_\_mul\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1494 | +.3 \dunder{truediv}\DTcomment{divide: \pythonil{a / b} $\equiv$ \pythonil{a.\_\_truediv\_\_(b)}}. |
| 1495 | +.3 \dunder{rtruediv}\DTcomment{right-divide: \pythonil{a / b} $\equiv$ \pythonil{b.\_\_rtruediv\_\_(a)}, if \pythonil{a.\_\_truediv\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1496 | +.3 \dunder{mod}\DTcomment{modulo-divide: \pythonil{a \% b} $\equiv$ \pythonil{a.\_\_mod\_\_(b)}}. |
| 1497 | +.3 \dunder{rmod}\DTcomment{right-modulo-divide: \pythonil{a \% b} $\equiv$ \pythonil{b.\_\_rmod\_\_(a)}, if \pythonil{a.\_\_mod\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1498 | +.3 \dunder{floordiv}\DTcomment{integer-divide: \pythonil{a // b} $\equiv$ \pythonil{a.\_\_floordiv\_\_(b)}}. |
| 1499 | +.3 \dunder{rfloordiv}\DTcomment{right-integer-divide: \pythonil{a // b} $\equiv$ \pythonil{b.\_\_rfloordiv\_\_(a)}, if \pythonil{a.\_\_floordiv\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1500 | +.3 \dunder{pow}\DTcomment{exponential: \pythonil{a ** b} $\equiv$ \pythonil{a.\_\_pow\_\_(b)}}. |
| 1501 | +.3 \dunder{rpow}\DTcomment{right-exponential: \pythonil{a ** b} $\equiv$ \pythonil{b.\_\_rpow\_\_(a)}, if \pythonil{a.\_\_pow\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
| 1502 | +.3 \dunder{matmul}\DTcomment{matrix-multiply: \pythonil{a @ b} $\equiv$ \pythonil{a.\_\_matmul\_\_(b)}}. |
| 1503 | +.3 \dunder{rmatmul}\DTcomment{right-matrix-multiply: \pythonil{a @ b} $\equiv$ \pythonil{b.\_\_rmatmul\_\_(a)}, if \pythonil{a.\_\_matmul\_\_(b)} yields~\pythonilIdx{NotImplemented}}. |
1503 | 1504 | }%
|
1504 | 1505 | %
|
1505 | 1506 | \caption{An overview of the dunder in \python.}%
|
|
0 commit comments