A Standard

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Mon May 26 22:07:15 EDT 2003


Andrew Koenig wrote:
> For example, in C++, every random-access iterator is also a forward iterator.
> Accordingly, every algorithm that operators on forward iterators will also
> operate on random-access iterators.

And in Python, every sequence (i.e. something that
implements __getitem__) can be iterated over, so
every algorithm that operates on iterables will
also operate on sequences.

Seems to me the concepts are quite similar, it's
just that the terminology is slightly different.

    STL                           Python
    --------------------------    ------------
    random-access iterator        sequence
    forward iterator              iterable

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list