Skip to content

Instantly share code, notes, and snippets.

@inducer
Created May 1, 2015 15:41
Show Gist options
  • Save inducer/78b0d240b7b4ae8f1bd9 to your computer and use it in GitHub Desktop.
Save inducer/78b0d240b7b4ae8f1bd9 to your computer and use it in GitHub Desktop.
def map_comparison(self, expr, *args, **kwargs):
return type(expr)(
self.rec(expr.left, *args, **kwargs),
expr.operator,
self.rec(expr.right, *args, **kwargs))
def map_logical_not(self, expr, *args, **kwargs):
return type(expr)(
self.rec(expr.child, *args, **kwargs))
def map_logical_or(self, expr, *args, **kwargs):
return type(expr)(tuple(
self.rec(child, *args, **kwargs) for child in expr.children))
map_logical_and = map_logical_or
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment