Evaluate and display command line expressions with python -me expr
Project description
For example:
$ python -me 1 + 1 2
Like python -c but no need for a print. But wait, there’s more.
As a bonus, if the first argument is a module name then it will output the location of the module source code:
$ python -me os /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/os.py
If you follow the name of the module with a command then the module will be opened with that command. For example, the following will open the os module source in vim:
$ python -me os vim
The “e” module recognises the special command names “edit” and “view” which will result in it looking up your editor and viewer commands in the environment variables $EDITOR and $PAGER respectively. The latter defaults to “less”. This is slightly easier than writing, for example:
$ vim `python -me os`
… especially if you’re going back to edit a previous “python -me” command using line editing.
Also, “python -me help” is a shortcut to Python’s interactive help mechanism.
Idea from Georg Brandl. Foolishly implemented by Michael Foord and Richard Jones.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file e-1.4.4.tar.gz
.
File metadata
- Download URL: e-1.4.4.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16e0108d828398cc0a73745d086d8e7703ff86e891fa13e61c8989610453ded |
|
MD5 | dca7dbb239defc4fa83b66b97ab3fdea |
|
BLAKE2b-256 | 480fabf158f079da6dca8c6002daddd977bc8bdc379712500c6fbd1c1d5784af |