Python | Kosta



Quick and Dirty Lambda Tracing in Python

Since in python2 print is a statement, it cannot be inserted in a lambda expression. If for some reason one still wants to trace a lambda, e.g. because some config file of some app one uses accepts a lambda definition, the following quick and dirty trick would work (on *nix): lambda input: open('/dev/stdout', 'w').write(''.join([input,'\n'])) and whatever

March 10, 2016