A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-May/053369.html below:

[Python-Dev] PEP 340: Breaking out.

[Python-Dev] PEP 340: Breaking out. [Python-Dev] PEP 340: Breaking out.Delaney, Timothy C (Timothy) tdelaney at avaya.com
Thu May 5 01:37:18 CEST 2005
Aahz wrote:

> My standard workaround is using exceptions, but I'm not sure how that
> interacts with a block:
> 
>     try:
>         for name in filenames:
>             with opened(name) as f:
>                 if f.read(2) == 0xFEB0:
>                     raise Found
>     except Found:
>         pass

For any sane block iterator, it will work as expected. However, an evil
block iterator could suppress the `Found` exception.

A sane block iterator should re-raise the original exception.

Tim Delaney
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4