On Wed, 29 Dec 2010 13:36:53 +0000
Michael Foord
Hello all,
I often use python as a calculator or for simple operations using -c. It would be enormously useful if python -c "..." would output on stdout the result of the last evaluated expression in the same way that the interactive interpreter does.
The following outputs nothing:
python -c "12 / 4.1"
So you always have to prefix expressions with print to see the result.
Is sparing the need to type print() really worthwhile here? I often leave a Python interpreter prompt open in a terminal so that I can try out whatever I need there, so I don't have to type "python -c", I can reuse previous results and imports, etc. Unless you are severaly RAM-limited (or OS X has poor multiwindowing capabilities ;-)), this should probably suit you as well. Regards Antoine.