Message235705
| Author |
zach.ware |
| Recipients |
docs@python, georg.brandl, jgehrcke, krivushinme, pitrou, vstinner, zach.ware |
| Date |
2015年02月10日.20:59:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1423601967.13.0.801675322941.issue23427@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Rather than add a variable to sys that will be empty 99% of the time, I think I'd rather stick a '__command__' constant in the __main__ module namespace when running with '-c' (think of '__file__'). You could then get at it elsewhere with 'from __main__ import __command__' (probably wrapped in a try/except ImportError, since it will usually not exist).
This should probably be discussed on python-ideas.
(Removing all versions but 3.5, as this is a feature request.) |
|