On Monday, August 22, 2016 at 10:53:23 AM UTC-7, Volker Braun wrote:

> IMHO iterators must not have global state, which is really just a 
> corollary to "global variables are bad". In particular, iterating twice 
> simultaneously should work. With the exception of input iterators of 
> course, but iterating over a tree doesn't consume it.
>

Just to make sure we stay compatible with python terminology: iterators get 
consumed and have their state altered by calling "next" on them. Iterables 
are objects that can be iterated over, meaning that calling "iter" on them 
produces an iterator on which one can call "next".

Iterators themselves are required to be "iterable", but in a strange way: 
calling "iter" on an iterators gives you back an identical object! In 
particular, if I is an iterator then calling next(I) and next(iter(I)) 
should have exactly the same result (in both cases modifying the state of 
I).

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

Reply via email to