> Of course for such simple expression, that function > will not run recursively, but for more complex > expressions, it will, as a example: > a + b * ( c + ( d - e ) / f )...
No, it won't. You seem to not properly understand what recursion is, and confuse it with overloaded methods. The compute-method of an expression ast node is called once for every node - to yield its value. Not more - not less. The fact for a * b the compute methods of objects representing the variables a and b is called inside a binary operator object neither makes it recursive nor costs more time. So there are three compute calls - first on the *-Operator object, then on a and b. Using depth-first-search, there are three calls of compute - first on a, b, then on *. So three compute calls in both cases. As I said before: No reason not to do depth-first, if it suits your needs. But it won't buy you anything. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list