Brett Cannon added the comment:

Maybe we just need to clarify some documentation at this point? All of the 
differences in semantics make total sense when you realize `-m pkg` is really 
conceptually shorthand for `import pkg.__main__` (w/ the appropriate __name__ 
flourishes). When you begin to view it that way then specifying the file path 
starts to look like the odd way by bypassing import and simply running open() 
on a file and passing the result to exec() (once again, with the appropriate 
__name__ flourishes). It also makes the point that -m isn't really shorthand 
for specifying a script which seems to be where people are getting tripped up 
by the differences.

So instead of selling `-m` as a way to run a module/package as a script, I say 
we change the message/documentation to say it does an import with __name__ 
changed and make specifying a script as the weird reading-a-file-directly thing.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16737>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to