On 29 December 2010 14:55, Antoine Pitrou <email@example.com>
On Wed, 29 Dec 2010 13:36:53 +0000
> Hello all,Is sparing the need to type print() really worthwhile here?
> 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.
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.