"Mark H. Harris" <harrismh...@gmail.com>: > Yep, my point exactly. nice illustration.
So now, for you and me: let's compare. if key is ast.Assign: return ' '.join(dump(t) for t in node.targets) elif key is ast.AugAssign: # Same target and same operator. return dump(node.target) + dump(node.op) + "=" elif key is ast.Return: # A return statement is always compatible with another. return "(easy)" elif key is ast.Expr: # Calling these never compatible is wrong. Calling them # always compatible will give lots of false positives. return "(maybe)" else: # These ones are never compatible, so return some # object that's never equal to anything. return float("nan") vs (my proposal): with key from ast: if Assign: return ' '.join(dump(t) for t in node.targets) elif AugAssign: # Same target and same operator. return dump(node.target) + dump(node.op) + "=" elif Return: # A return statement is always compatible with another. return "(easy)" elif Expr: # Calling these never compatible is wrong. Calling them # always compatible will give lots of false positives. return "(maybe)" else: # These ones are never compatible, so return some # object that's never equal to anything. return float("nan") Which do *you* find more readable? Marko -- https://mail.python.org/mailman/listinfo/python-list