[Python-ideas] python -c "..." should output result like the interpreter

Michael Foord fuzzyman at voidspace.org.uk
Wed Dec 29 14:36:53 CET 2010


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.

Michael

-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101229/5423452f/attachment.html>


More information about the Python-ideas mailing list