On 29 December 2010 15:45, Michael Foord email@example.com wrote:
On 29 December 2010 15:18, Georg Brandl firstname.lastname@example.org wrote:
Am 29.12.2010 15:46, schrieb Michael Foord:
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?
you'd have python -e "12 / 4.1" (AFAICT, -e is unused at present).
That would be great. I did worry that changing the output would be
incompatible with code that shells out to Python using "-c", so a
command line option would be great. So long as it works with multiple
(semi-colon separated) like the current "-c" behaviour.
Hey, what about this little module:
import sys for x in sys.argv[1:]: exec compile(x, '<cmdline>', 'single')
$ python -me '1+1; 2+2' 2 4
So now you can `pip install e` and then `python -me`...
As an added bonus if the first argument is a module name it will print out the location of the module on the filesystem.
Python-ideas mailing list Pythonemail@example.com http://mail.python.org/mailman/listinfo/python-ideas
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