Comparisons
Equals (==), inequality (!=)
- The only comparison operator that can be used cross type, but only with
None - Equal comparisons between different types that are not None will always result in a crash, e.g. int(2) == dec(2)
- Not equal comparisons between different types that are not None will always result in a cresh, e.g. int(2) != dec(2)
- Equal comparisons on any non-
Nonevalue withNonewill always beFalse - Not equal comparisons on any non-
Nonevalue withNonewill always beTrue - Can not be chained
Less than (<), greater than (>), less than or equal to (<=), greater than or equal to (>=)
- Does not work for
dictandfunctiontypes - For strings, the comparison is alphabetical
- For lists, it compares items on an item-to-item basis
- Will fail on root level type mismatches (elements will not be ducked-typed into comparisons)
- Can not be chained
in and has
- Checks to look for a value inside a list or inside the keys of a dictionary
- One side of the operator must be a list value to look for, the other side must be a list
- Order does not matter
- The list must all contain elements of the same type
- Can not be chained
Note
sneq does not support in or has to match substrings. This functionality is provided by the util.strings.match function.