I think you have some really valid points in your answer, Steven. To me, it 
seems like we have two main options to improve the message for shadowing 
modules. I copied part of your and Random832’s answer here, since they 
summarize it quite nicely:

1. If a module attempts to directly import a module with the same name, and 
that import fails for any reason, we include a message about shadowing in 
addition to the normal exception traceback.

2. Always print a warning [not an error]
when importing a module from the current directory [the first entry in 
sys.path] that is
also available in any other entry in sys.path

I think both methods would add significant information. The second option would 
help a lot in the cases where the program still works, but doesn’t throw an 
error (possibly because the accessed objects exist in both modules).

Either way, giving a hint that a module might be shadowed by the running 
program would help significantly.

--
Gustav
_______________________________________________
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/MQ3BEVNME5KXW4GFGI6K7JWTJCS3Y37P/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to