Andrew Barnert wrote: > What does it do for zipimported modules, bootstrapped modules, modules > distributed as a .pyc file without the .py source, etc., plain old .py filed > but that are > found in an unusual way (a 3.x equivalent of Apple’s 2.7 Extras directory, or > even a > custom importlib finder), whatever Pythonista does on iOS, etc., much less > modules that > use a custom loader?
All excellent questions, of which I had not thought. Research required! > Also, even for normal .py imports on a stock CPython on Windows or Mac > installation, > can a non-sophisticated user (or automated software) reliably distinguish > system, site, > added-by-old-school-egg, user, venv, script-dir, and custom based on the > pathname? The way I see it, if someone is trying to diagnose a bug coming from a wrong-location import, in order to succeed they are inevitably going to have to become rather *un*-non-sophisticated about the import path cascade in the process. And no, I suspect it would be *quite* hard to write automated software able to reliably assign a given module's path into those categories. It raises basically the same set of problems as writing an automated mechanism for _constraining_ imports only to certain of those category/ies; it "... would be a piece of a nightmare...." _______________________________________________ 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/Y4KJ3THDE6PERXKILCKG3BT7UKU4T377/ Code of Conduct: http://python.org/psf/codeofconduct/