Am 29.08.2012 17:04, schrieb Franck Ditter:
I use Python 3.2.3 + Idle.
Is it possible to program test(e) which takes
an expression e and whose execution produces
at the toplevel an echo of e and the effects
and result of its evaluation ?
Yes, the key to this is using a lambda expression.
# f
On 8/29/2012 11:04 AM, Franck Ditter wrote:
I use Python 3.2.3 + Idle.
Is it possible to program test(e) which takes
an expression e and whose execution produces
at the toplevel an echo of e and the effects
and result of its evaluation ?
No, not as Python is delivered.
# file foo.py
def foo(
Hi !
I use Python 3.2.3 + Idle.
Is it possible to program test(e) which takes
an expression e and whose execution produces
at the toplevel an echo of e and the effects
and result of its evaluation ?
# file foo.py
def foo(x) :
print('x =',x)
return x+1
test(foo(5))
# RUN !
# produces at the