Steve Dower <steve.do...@python.org> added the comment:

The best option for restricting the import while still having it be a Python 
import is to find the file (if it's present in the expected location under 
sys.whatever), and then use importlib to import it: 
https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly

I'd rather not have a new option here, I would much prefer "-S" in this context 
to mean "run Python with only core libraries" and "-s" to mean "run Python with 
only core and distro libraries" (and neither to mean "run Python with core, 
distro and user libraries").

That may be a bigger change, but there's enough angst around this issue that we 
would be better off getting it right this time, even if it changes things, than 
continuing to preserve the system that people dislike so much.

----------

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

Reply via email to