Skip to content

Commit

Permalink
cleanup Expr (aimacode#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
norvig committed Apr 9, 2016
1 parent 8db3802 commit 240ab1a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ def __lshift__(self, rhs): return Expr('<<', self, rhs)
def __truediv__(self, rhs): return Expr('/', self, rhs)
def __floordiv__(self, rhs): return Expr('//', self, rhs)
def __matmul__(self, rhs): return Expr('@', self, rhs)

def __or__(self, rhs):
if isinstance(rhs, Expression) :
return Expr('|', self, rhs)
else return NotImplemented # So that InfixOp can handle it
else:
return NotImplemented # So that InfixOp can handle it

# Reverse operator overloads
def __radd__(self, lhs): return Expr('+', lhs, self)
Expand Down

0 comments on commit 240ab1a

Please sign in to comment.