Guenther Sohler <
guenther.sohler@gmail.com> writes:
I am wondering If an embedded Python Interpreter can detect unassigned >Expressions. Cases where functions Return values but they are Not
assignwd. E.g.
Calc_square(4)
Or
3*4-myval()
1. If "Calc_square(4)" appears in the context "n=Calc_square(4)",
then its value is assigned. So, it is not necessarily an example
of a function call expression the value of which is not assigned.
2. In Python function call expressions always have a value.
3. If you can modify the the interpreter, you surely can make it
emit an expression such as "Info: The value of the function call
expression 'Calc_square(4)' was not bound to an identifier.".
4. You also can use the parser library that comes with Python to
parse source code and detect such situations yourself. E.g.,
import ast
...
parse = ast.parse( source, filename )
for entry in ast.walk( parse ):
...
.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)