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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to