from
Tushar Udeshi <tudeshi at zyvex dot com>
subject
[Python-logic] Bug in astng.py.
date
Hello,2005/06/30 12:00
I believe there is a bug in asntg.py in the function
compare_as_string(node). as_string needs to be called on expr as well.
Else calling as_string on a Compare node spits out the ASTNode. For
example:
ast = builder.string_build("a == 2")
ast.as_string()
spits out
'ast == Const(2)'
The fixed function is below.
def compare_as_string(node):
"""return an ast.Compare node as string"""
return '%s %s' % (node.expr.as_string(), ' '.join(['%s %s' % (op,
expr.as_string())
for op, expr
in node.ops]))
. . . . . . . . . . . . . . . . . . . . . .
Tushar Udeshi
Staff Engineer, Software
Zyvex Corporation
Providing Nanotechnology Solutions - Today
w: www.zyvex.com t: 972.792.1646
f: 972.235.7882 e: tudeshi@zyvex.com
. . . . . . . . . . . . . . . . . . . . . .
_______________________________________________
Python-logic mailing list
Python-logic@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-logic
