On Sat, Aug 01, 2020 at 03:57:34PM +1000, Chris Angelico wrote: > Ahh, okay. So it's safe in the sense that it can't accidentally leak a > confusing exception. Unfortunately a lot of people are going to assume > that it means "will always give a useful return value". Definitely > worth being very very clear about the semantics.
What you name the function is up to you :-) > And it's really not the ideal semantics here anyway. What you actually > want is ValueError if the dict is empty. Your wish is my command: mynext = exception_guard(catch=StopIteration, throw=ValueError)(next) -- Steven _______________________________________________ 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/B5FIE43QBMMGGFYXDJYMWYB64D4SR6HW/ Code of Conduct: http://python.org/psf/codeofconduct/