[Python-Dev] Re: anonymous blocks (original) (raw)
Guido van Rossum gvanrossum at gmail.com
Wed Apr 27 23:57:01 CEST 2005
- Previous message: [Python-Dev] Re: anonymous blocks
- Next message: [Python-Dev] Re: anonymous blocks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
If the iterator fails to re-raise the StopIteration exception (the spec only says it should, not that it must) I think the return would be ignored but a subsquent exception would then get converted into a return value. I think the flag needs reset to avoid this case.
Good catch. I've fixed this in the PEP.
Also, I wonder whether other exceptions from next() shouldn't be handled a bit differently. If BLOCK1 throws an exception, and this causes the iterator to also throw an exception then one exception will be lost. I think it would be better to propogate the original exception rather than the second exception.
I don't think so. It's similar to this case:
try:
raise Foo
except:
raise Bar
Here, Foo is also lost.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Re: anonymous blocks
- Next message: [Python-Dev] Re: anonymous blocks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]