On Sat, Jan 11, 2020 at 11:27:51AM -0300, Soni L. wrote: > PYTHONPATH=foo/bar python -m baz.qux > > becomes > > python -m foo/bar/baz.qux > > which is less of a kludge.
Sorry Soni, I completely disagree with you. The status quo `PYTHONPATH=foo/bar python -m baz.qux` is explicit about changing the PYTHONPATH and it uses a common, standard shell feature. This takes two well-designed components that work well, and can be understood in isolation, and plugging them together. The first part of the command explicitly sets the PYTHONPATH, the second part of the command searches the PYTHONPATH for the named module. Far from being a kludge, I think this is elegant, effective design. It seems to me that your proposed syntax is the kludge: it mixes pathnames and module identifiers into a complex, potentially ambiguous "half path, half module spec" hybrid: foo/bar/baz.qux * foo/bar/ is a pathname * baz.qux is a fully-qualified module identifier, not a file name The reader has to read that and remember that even though it looks exactly like a pathname, it isn't, it does not refer to the file "baz.qux" in directory "foo/bar/". It means: * temporarily add "foo/bar/" to the PYTHONPATH * find package "baz" (which could be anywhere in the PYTHONPATH) * run the module baz.qux (which might not be qux.py) -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KXIX3PFHKJFYBNEIGO2FYCDDDTFLVSND/ Code of Conduct: http://python.org/psf/codeofconduct/