[C++-sig] call python iterable (handle StopIteration?)

Stefan Seefeld seefeld at sympatico.ca
Tue Jul 17 16:05:55 CEST 2007


Neal Becker wrote:

> Interestingly, this _seems_ to work:
> 
> try {
>   while (true) {
>     o.attr ("next")()...
>   }
> }
> catch (error_already_set) {
>   use result..
> }

Yes, it should. Though you will also break out of the loop for other
exceptions (which you may want to deal with within the loop...).

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list