Expand description
An equivalent object hierarchy to the RustPython AST hierarchy, but with the
ability to compare expressions for equality (via Eq and Hash).
Two ComparableExprs are considered equal if the underlying AST nodes have the
same shape, ignoring trivia (e.g., parentheses, comments, and whitespace), the
location in the source code, and other contextual information (e.g., whether they
represent reads or writes, which is typically encoded in the Python AST).
For example, in [(a, b) for a, b in c], the (a, b) and a, b expressions are
considered equal, despite the former being parenthesized, and despite the former
being a write (ast::ExprContext::Store) and the latter being a read
(ast::ExprContext::Load).
Similarly, "a" "b" and "ab" would be considered equal, despite the former being
an implicit concatenation of string literals, as these expressions are considered to
have the same shape in that they evaluate to the same value.
Structs§
- Comparable
Alias - Comparable
Arguments - Comparable
Bytes Literal - Comparable
Comprehension - Comparable
Decorator - Comparable
Dict Item - Comparable
Elif Else Clause - ComparableF
String - Comparable
Keyword - Comparable
Match Case - Comparable
ModExpression - Comparable
ModModule - Comparable
Parameter - Comparable
Parameter With Default - Comparable
Parameters - Comparable
Pattern Arguments - Comparable
Pattern Keyword - Comparable
String Literal - ComparableT
String - Comparable
Type Params - Comparable
With Item - Except
Handler Except Handler - Expr
Attribute - Expr
Await - Expr
BinOp - Expr
Bool Literal - Expr
Bool Op - Expr
Bytes Literal - Expr
Call - Expr
Compare - Expr
Dict - Expr
Dict Comp - ExprF
String - Expr
Generator - ExprIf
- Expr
Interpolated Element - Expr
IpyEscape Command - Expr
Lambda - Expr
List - Expr
List Comp - Expr
Name - Expr
Named - Expr
Number Literal - ExprSet
- Expr
SetComp - Expr
Slice - Expr
Starred - Expr
String Literal - Expr
Subscript - ExprT
String - Expr
Tuple - Expr
Unary Op - Expr
Yield - Expr
Yield From - Hashable
Expr - Wrapper around
Exprthat implementsHashandPartialEqaccording to Python semantics: - Interpolated
Element - Pattern
Match As - Pattern
Match Class - Pattern
Match Mapping - Pattern
Match Or - Pattern
Match Sequence - Pattern
Match Singleton - Pattern
Match Star - Pattern
Match Value - Stmt
AnnAssign - Stmt
Assert - Stmt
Assign - Stmt
AugAssign - Stmt
Class Def - Stmt
Delete - Stmt
Expr - StmtFor
- Stmt
Function Def - Stmt
Global - StmtIf
- Stmt
Import - Stmt
Import From - Stmt
IpyEscape Command - Stmt
Match - Stmt
Nonlocal - Stmt
Raise - Stmt
Return - StmtTry
- Stmt
Type Alias - Stmt
While - Stmt
With - Type
Param Param Spec - Type
Param Type Var - Type
Param Type VarTuple