On Tue, Oct 12, 2021 at 11:47 PM Steven D'Aprano email@example.com wrote:
Shouldn't your safe_map raise RuntimeError rather than ValueError? That's what PEP 479 does *wink*
If I'm explicitly choosing the exception to raise, ValueError seems better, although I'd also see TypeError as plausible. But the point isn't *which* exception is raised; the point is that it won't simply early-abort, as the naive one does. I never intended to replicate PEP 479 semantics here, just the equivalent level of safety against bizarre behaviours.
Thanks for nitpicking, though. In return, I'll point out that I never actually created anything called safe_map :)