From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2008-06-10 15:58:21
Gennadiy Rozental wrote:
> I an using vector_indexing_suite for both standard containers export and for our
> in-house ones. I've noticed that boost::python::error_already_set is bwing
> thrown every time iteration in python over container instances is about to
> finish. The exception is ignored somewhere inside boost::python but it's still
> quite inconvenient for debugging: I want to catch actual error, but can't skip
> 100s of fake ones. Is there any reason why it was designed this way? Is there
> any way to avoid it?
A 'StopIteration' exception is the mechanism by which Python terminates
an iteration. This exception is certainly not ignored. It is simply
translated and handed over to the Python runtime. I'm not sure I
understand how that gets into the way of debugging.
However, you don't need to use iterators to traverse a container. Simply
fetching a container's size and then use the usual operator works
fine, too (though it might well be slower).
-- ...ich hab' noch einen Koffer in Berlin...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk