On Sun, Jun 28, 2015 at 10:07:43AM +0200, Nicolas Borie wrote:
> Le 28/06/2015 06:55, Anne Schilling a écrit :
> >Is this what I should expect from this code:
> >
> >sage: positions=[1,2,3,4,5,6]
> >sage: for j in positions:
> >....:     positions.remove(j)
> >....:
> >sage: positions
> >[2, 4, 6]
> Whaoooo this one will increase my collection of tricky examples... There is
> a war in my university : "C language against Python language, what is the
> best for computer sciences education ?"
> 
> This is pure Python code and Python comes from C...

I would indeed assume that the iterator invalidation rules for
Python's list and for the analogue C++ containers (e.g. vector) or C
arrays are similar:

        http://stackoverflow.com/questions/6438086/iterator-invalidation-rules

Cheers,
                                Nicolas
--
Nicolas M. Thiéry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to