Hypothetically, if __enter__ could be a generator, with the with body running for each yielded value, that would give us the power to implement class Loop: def __enter__(self): self._do_continue = ...
Perl has goto mostly because it made the Awk-to-Perl translator easier to implement. It was never recommended for general usage by people in their own programs.