Re: How to program test(expr) ?

2012-08-30 Thread Ulrich Eckhardt
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

Re: How to program test(expr) ?

2012-08-29 Thread Terry Reedy
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(

How to program test(expr) ?

2012-08-29 Thread Franck Ditter
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