Zachary Ware added the comment:
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.)
----------
assignee: docs@python ->
components: -Documentation
nosy: +zach.ware
versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.6
_______________________________________
Python tracker