It seems like most of us agree that the speed drawbacks wouldn’t be worth it — 
which I find understandable.

If my understanding of excepthooks is correct, and that it’s the place to put 
code that should be executed once an AttributeError is raised, it sounds like a 
great solution.

However, AttributeErrors aren’t the only exceptions raised when a shadowing 
module is imported. A broad range of exceptions could be raised as a result of 
an unintended module being imported. 

One option would be to implement a similar search whenever any exception is 
raised and the conditions that you mentioned apply. Limiting it to 
AttributeError would be odd.

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

Reply via email to