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

Michael Foord fuzzyman at voidspace.org.uk
Wed Dec 29 17:37:20 CET 2010


On 29 December 2010 16:35, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> On Wed, Dec 29, 2010 at 9:40 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> ..
> > I like the idea, but that's a fairly big semantic change. What about
> > adding an -e option that takes an expression, and prints its value? So
> > you'd have
> >
> >    python -e "12 / 4.1"
> >
> > (AFAICT, -e is unused at present).
> >
>
> +1
>
> For some reason I always type -e (for "eval" or "exec"?) before
> realizing that it should have been -c.
>
> What do you think  python -e "for i in range(5): i" should print?
> Note that on >>> prompt:
>
> >>> for i in range(5): i
> ...
> 0
> 1
> 2
> 3
> 4
>


I'd be happy with the same behaviour as the interactive interpreter.

Michael


> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 

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/68922086/attachment.html>


More information about the Python-ideas mailing list