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

Antoine Pitrou solipsis at pitrou.net
Wed Dec 29 16:20:49 CET 2010


On Wed, 29 Dec 2010 16:13:15 +0100
Georg Brandl <g.brandl at gmx.net> wrote:
> Am 29.12.2010 14:36, schrieb 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.
> 
> If it did, you couldn't do this anymore (with the obvious implementation):
> 
>    python -c 'print 1
>    print 2'
> 
> which I guess a few people do rely upon.
> 
> A new -e option would be fine, but -- YAGNI?

Apparently, MIGNI.






More information about the Python-ideas mailing list