消息 [235705]
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.) |
|
| 日期 |
用户 |
动作 |
参数 |
| 2015-02-10 20:59:27 | zach.ware | 修改 | recipients:
+ zach.ware, georg.brandl, pitrou, vstinner, jgehrcke, docs@python, krivushinme |
| 2015-02-10 20:59:27 | zach.ware | 修改 | messageid: <1423601967.13.0.801675322941.issue23427@psf.upfronthosting.co.za> |
| 2015-02-10 20:59:27 | zach.ware | 链接 | issue23427 messages |
| 2015-02-10 20:59:26 | zach.ware | 创建 | |
|