On Sun, Jan 12, 2020 at 11:10 AM Steven D'Aprano <[email protected]> wrote: > You seem to be asking to weld a screwdriver head to a hammer so that you > can have the hammer behave like a screwdriver. If you know the precise > path you want to run, why are you using > > # your proposed syntax > python -m spam/eggs/cheese.aardvark > > when you could just as easily run this and get the effect you want? > > python spam/eggs/cheese/aardvark.py > > This is not a rhetorical question. As far as I can tell from your > explanation so far, what you want to do is possible *right now* if you > just stop typing `-m` after the `python` command and use the right tool > for the job. > > If you see a difference that I don't, please explain what that > difference is.
The biggest difference is that scripts can't do relative imports. So here's a counter-proposal: Allow "from . import modulename" to import "modulename.py" from the directory that contains the script that Python first executed (or, for interactive Python, the current directory as Python started). ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/XSCGYDUGIGOZSFAFGSZS43JRTLYT32FC/ Code of Conduct: http://python.org/psf/codeofconduct/
