Commit c44c904a authored by cclauss's avatar cclauss Committed by Dylan Trotter

Simplify with or, msg lookup with dict.get() (#152)

parent 90786d22
......@@ -33,11 +33,9 @@ class Package(object):
def __init__(self, name, alias=None):
self.name = name
if not alias:
# Use Γ as a separator since it provides readability with a low
# probability of name collisions.
alias = 'π_' + name.replace('/', 'Γ').replace('.', 'Γ')
self.alias = alias
self.alias = alias or 'π_' + name.replace('/', 'Γ').replace('.', 'Γ')
class Loop(object):
......@@ -423,8 +421,7 @@ class BlockVisitor(ast.NodeVisitor):
self.vars[name] = Var(name, Var.TYPE_GLOBAL)
def _register_local(self, name):
var = self.vars.get(name)
if not var:
if not self.vars.get(name):
self.vars[name] = Var(name, Var.TYPE_LOCAL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment