<br><br><div class="gmail_quote">On 29 December 2010 15:45, Michael Foord <span dir="ltr"><<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On 29 December 2010 15:18, Georg Brandl <span dir="ltr"><<a href="mailto:g.brandl@gmx.net" target="_blank">g.brandl@gmx.net</a>></span> wrote:<br></div><div class="im">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Am 29.12.2010 15:46, schrieb Michael Foord:<br>
<div><br>
>     I like the idea, but that's a fairly big semantic change. What about<br>
>     adding an -e option that takes an expression, and prints its value? So<br>
>     you'd have<br>
><br>
>        python -e "12 / 4.1"<br>
><br>
>     (AFAICT, -e is unused at present).<br>
><br>
> That would be great. I did worry that changing the output would be backwards<br>
> incompatible with code that shells out to Python using "-c", so a different<br>
> command line option would be great. So long as it works with multiple statements<br>
> (semi-colon separated) like the current "-c" behaviour.<br>
<br>
</div>Hey, what about this little module:<br>
<br>
import sys<br>
for x in sys.argv[1:]:<br>
    exec compile(x, '<cmdline>', 'single')<br>
<br>
Then:<br>
<br>
$ python -me '1+1; 2+2'<br>
2<br>
4<br></blockquote></div><div><br>So now you can `pip install e` and then `python -me`...<br></div></div></blockquote><div><br><br>Just as a follow up, for which we should still be blaming Georg, you can now do `pip install oo` followed by `python -moo`. <br>
<br>(Requires pygame - tested on Linux and Mac should be cross platform.)<br><br>All the best,<br><br>Michael Foord <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div><font color="#888888"><br>Michael <br> <br></font></div><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<font color="#888888"><br>
Georg<br>
</font><div><div></div><div><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div></div><br><br clear="all"><div><div></div><div class="h5"><br>-- <br><pre cols="72"><a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br><br>May you do good and not evil<br>
May you find forgiveness for yourself and forgive others<br>
May you share freely, never taking more than you give.<br>-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a></pre>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><pre cols="72"><a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br><br>May you do good and not evil<br>May you find forgiveness for yourself and forgive others<br>
May you share freely, never taking more than you give.<br>-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a></pre>
<br>