changeset 162:427fbd7bd36b

pretty_print: now handles attributes.
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 09 Dec 2009 12:44:50 +0100
parents 78523235f367
children 0b1c4d4961af
files pysmcl/pretty_print.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/pretty_print.py	Mon Dec 07 16:30:04 2009 +0100
+++ b/pysmcl/pretty_print.py	Wed Dec 09 12:44:50 2009 +0100
@@ -195,6 +195,10 @@
     elif(isinstance(exp, dict)):
         print >>output, exp
         assert False, "Type error"
+    elif(isinstance(exp, ast.Attribute)):
+        my_precedence = 100
+        r = "%s.%s" % (expr_string(exp.value, 1),
+                       exp.identifier)
     elif(isinstance(exp, ast.Subscript)):
         my_precedence = 21
         r = "%s[%s]" % \
@@ -228,7 +232,6 @@
 #             -- other literals? bools?
 #
 #             -- the following expression can appear in assignment context
-#             | Attribute(expr value, identifier attr, expr_context ctx)
 #             | Subscript(expr value, slice slice, expr_context ctx)
 #             | Name(identifier id, expr_context ctx)
 #             | List(expr* elts, expr_context ctx)