Author brett.cannon
Recipients Ben Lewis2, brett.cannon, eric.snow, hroncok, miss-islington, ncoghlan, rhettinger, serhiy.storchaka
Date 2020-01-22.18:36:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579718209.51.0.559655788304.issue37444@roundup.psfhosted.org>
In-reply-to
Content
The problem with the hybrid exception is that importlib would then still raise a different exception from import itself, so the discrepancy would persist. And if you updated import you could then break people in another way where they were catching ValueError and ImportError separately for different cases and now they would potentially catch the wrong exception for that ValueError case.

Basically changing what exceptions get raised sucks as someone is almost inevitably broken. But since import and importlib strive to mirror each other as much as possible and be drop-in replacements, the consistency for the next 30 years of Python's life is more important I think than the case of:

1. Someone using importlib.import_module()
2. Who is specifically worried about relative imports going too far and no other import-related import and thus only catching ValueError and not ImportError
3. And are supporting older versions of Python
4. And will have a difficult time updating their `except` clause to now also capture ImportError
History
Date User Action Args
2020-01-22 18:36:49brett.cannonsetrecipients: + brett.cannon, rhettinger, ncoghlan, eric.snow, serhiy.storchaka, hroncok, miss-islington, Ben Lewis2
2020-01-22 18:36:49brett.cannonsetmessageid: <1579718209.51.0.559655788304.issue37444@roundup.psfhosted.org>
2020-01-22 18:36:49brett.cannonlinkissue37444 messages
2020-01-22 18:36:49brett.cannoncreate