On Tue, Oct 13, 2020 at 1:56 PM <jmward01@gmail.com> wrote:
I do agree that it is nice to have some ability to type the call more rigidly, just like a function call. I could see having functions, optionally, advertise exception calls as possible alternate returns but this should be just that, optional just to help out clarity.

OK.  But in 22 years, I've never had a desire to raise with custom args, and I've often had a desire to express inheritance relationships.  So this need feels to me to be rare, at most (and probably usually an antipattern).

That said, the ExceptionMaker that I proposed gets you exactly what you want already.  I like Chris' idea of defaultdict and square brackets even better than mine about memoization (maybe with @functools.lru_cache).  Either way, you already HAVE what you are asking for, except few people actually want to use it.

--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.