Opcode.COMPARE_OP, the argument
to which is the code attribute of the name in this
enum.
API Note
The order matches CPython's enumeration of operations
used in the argument to COMPARE_OP, so that we can
rely on it in the CPython byte code interpreter.
| Modifier and Type | Field and Description |
|---|---|
| public static final Comparison | BAD
A dummy operation representing an invalid comparison. |
| public static final Comparison | EQ
The |
| public static final Comparison | EXC_MATCH
The exception matching operation. |
| private static final Comparison[] | |
| public static final Comparison | GE
The |
| public static final Comparison | GT
The |
| public static final Comparison | IN
The |
| public static final Comparison | IS
The identity operation. |
| public static final Comparison | IS_NOT
The inverted identity operation. |
| public static final Comparison | LE
The |
| public static final Comparison | LT
The |
| public static final Comparison | NE
The |
| private static String | |
| public static final Comparison | NOT_IN
The inverted |
| private static String | |
| pack-priv final Slot | |
| private static final Comparison[] | |
| pack-priv final String |
| Access | Constructor and Description |
|---|---|
| private | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Object | |
| pack-priv PyException | Returns: the exceptionleft arg v, Object right arg w)Create a TypeError along the lines "OP not supported between instances of V and W" |
| pack-priv static Comparison | Returns: equivalentComparison objectopcode argument oparg)Translate CPython |
| pack-priv Comparison | Returns: swapped version of this comparisonThe swapped version of this comparison, e.g. LT with GT. |
| pack-priv abstract boolean | |
| public String | Returns: text correspondingOverrides java. NE,
"is not" for IS_NOT.
|
| public static Comparison | |
| public static Comparison[] |
| BAD | back to summary |
|---|---|
| public static final Comparison BAD A dummy operation representing an invalid comparison. | |
| EQ | back to summary |
|---|---|
| public static final Comparison EQ The | |
| EXC_MATCH | back to summary |
|---|---|
| public static final Comparison EXC_MATCH The exception matching operation. | |
| from | back to summary |
|---|---|
| private static final Comparison[] from | |
| GE | back to summary |
|---|---|
| public static final Comparison GE The | |
| GT | back to summary |
|---|---|
| public static final Comparison GT The | |
| IN | back to summary |
|---|---|
| public static final Comparison IN The LOAD_NAME 0 (v) LOAD_NAME 1 (seq) COMPARE_OP 6 (in)which must lead to seq.__contains__(v).
| |
| IS | back to summary |
|---|---|
| public static final Comparison IS The identity operation. | |
| IS_NOT | back to summary |
|---|---|
| public static final Comparison IS_NOT The inverted identity operation. | |
| LE | back to summary |
|---|---|
| public static final Comparison LE The | |
| LT | back to summary |
|---|---|
| public static final Comparison LT The | |
| NE | back to summary |
|---|---|
| public static final Comparison NE The | |
| NOT_CONTAINER | back to summary |
|---|---|
| private static String NOT_CONTAINER | |
| NOT_IN | back to summary |
|---|---|
| public static final Comparison NOT_IN The inverted | |
| NOT_SUPPORTED | back to summary |
|---|---|
| private static String NOT_SUPPORTED | |
| slot | back to summary |
|---|---|
| pack-priv final Slot slot | |
| swap | back to summary |
|---|---|
| private static final Comparison[] swap | |
| text | back to summary |
|---|---|
| pack-priv final String text | |
| Comparison | back to summary |
|---|---|
| private Comparison(String text, Slot slot) | |
| Comparison | back to summary |
|---|---|
| private Comparison(String text) | |
| apply | back to summary |
|---|---|
| pack-priv Object apply(Object v, Object w) throws Throwable Perform this comparison, raising comparison result
| |
| comparisonTypeError | back to summary |
|---|---|
| pack-priv PyException comparisonTypeError(Object v, Object w) Create a TypeError along the lines "OP not supported between instances of V and W" the exception | |
| from | back to summary |
|---|---|
| pack-priv static Comparison from(int oparg) Translate CPython
| |
| swapped | back to summary |
|---|---|
| pack-priv Comparison swapped() The swapped version of this comparison, e.g. LT with GT.
| |
| toBool | back to summary |
|---|---|
| pack-priv abstract boolean toBool(int c) Translate a comparison result into the appropriate boolean, for
example Avoid the temptation to use the result of a subtraction here unless there is no possibility of overflow in the subtraction.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. The text corresponding to the value, e.g. "!=" for | |
| valueOf | back to summary |
|---|---|
| public static Comparison valueOf(String name) | |
| values | back to summary |
|---|---|
| public static Comparison[] values() | |