[Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

Chris Angelico rosuav at gmail.com
Mon Jan 7 04:27:04 EST 2019


On Mon, Jan 7, 2019 at 7:11 PM Anders Hovmöller <boxed at killingar.net> wrote:
>
>
> > This proposal is basically about introducing goto to the language.
>
> A bit hyperbolic but I agree that it has the same problem as goto. But the specific suggested solution is not something we should be restricted so rigidly to in this discussion. One could for example see another solution to the same problem:
>
> with supress_raise(TypeError, ValueError):
>    do_the_things()
>
> I have no idea how to actually implement this though and it's also a bad idea but I think we should first find the best idea to solve the underlying pain point then talk about rejecting or supporting that.
>

You mean like this?

https://docs.python.org/3/library/contextlib.html#contextlib.suppress

ChrisA


More information about the Python-ideas mailing list