added @paultag suggestions

This commit is contained in:
Guillermo Vaya 2013-07-17 15:40:38 +02:00
parent 6778e9b2e1
commit 099ad28ad1

View File

@ -1144,13 +1144,9 @@ class HyASTCompiler(object):
# (assoc foo bar baz) => foo[bar] = baz # (assoc foo bar baz) => foo[bar] = baz
target = self.compile(expr.pop(0)) target = self.compile(expr.pop(0))
ret = target ret = target
while expr: i = iter(expr)
key = self.compile(expr.pop(0)) for (key, val) in ((self.compile(x), self.compile(y))
try: for (x, y) in zip(i, i)):
val = self.compile(expr.pop(0))
except IndexError:
raise HyCompileError(
"Key {key} has no value to associate".format(key))
ret += key + val + ast.Assign( ret += key + val + ast.Assign(
lineno=expr.start_line, lineno=expr.start_line,