On Fri, Oct 16, 2020 at 10:45 AM Rob Cliffe via Python-ideas <python-ideas@python.org> wrote: > One workaround I sometimes use is a pseudo-loop which is executed once > only; whenever the process can be abandoned, I `break` out of the > "loop". It ain't particularly elegant, but it works. Applying to the > OP's example we might have: > > for _ in '1': # pseudo-loop > # NB One gotcha is to write a pseudo-loop with something like "while True" > # and then forget to put in a final `break'. > try: > something > break > except SomeError: > pass > try: > something_else > break > except AnotherError: > pass > try: > something_completely_different > except Whatever: > return NotImplemented > > > I sometimes wish that Python provided nicer syntax for writing a > "pseudo-loop", but I guess it's not an urgent need. And I guess the > same applies to the OP's suggestion. So I'm -0.8 on it.
You mean like.... a goto statement? I'm not sure what a "pseudo-loop" is, other than a way to use break as goto. ChrisA _______________________________________________ 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/5J4EEFTKLGLSG6UULPWH6XSZLOIC4ICX/ Code of Conduct: http://python.org/psf/codeofconduct/