On 29 December 2010 14:55, Antoine Pitrou email@example.com wrote:
On Wed, 29 Dec 2010 13:36:53 +0000 Michael Foord firstname.lastname@example.org wrote:
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
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?
Well, what usually happens is that I forget I have to print and do it without first. Then when there is no output I remember and redo with the print in place. Making the print unnecessary would therefore mean substantially less than half as much typing....
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.
Python-ideas mailing list Pythonemail@example.com http://mail.python.org/mailman/listinfo/python-ideas