Skip to content
Snippets Groups Projects
Commit 11df1fd1 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Make tuple index stringification Py2.5-safe

parent 9773aebc
No related branches found
No related tags found
No related merge requests found
......@@ -135,12 +135,15 @@ class StringifyMapper(pymbolic.mapper.Mapper):
self.join_rec(", ", expr.parameters, PREC_NONE))
def map_subscript(self, expr, enclosing_prec):
if isinstance(expr.index, tuple):
index_str = self.join_rec(", ", expr.index, PREC_NONE)
else:
index_str = self.rec(expr.index, PREC_NONE)
return self.parenthesize_if_needed(
self.format("%s[%s]",
self.rec(expr.aggregate, PREC_CALL),
self.join_rec(", ", expr.index, PREC_NONE) if
isinstance(expr.index, tuple) else
self.rec(expr.index, PREC_NONE)),
index_str),
enclosing_prec, PREC_CALL)
def map_lookup(self, expr, enclosing_prec):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment