A Standard

Erik Max Francis max at alcyone.com
Mon May 26 00:15:28 EDT 2003


Andrew Koenig wrote:

> What I see in this description is that the Python notion of "sequence
> types"
> is decidedly non-sequential, because __getitem__ really takes an
> arbitrary
> index as input.  So what Python calls a "sequence type" is closest to
> the
> C++ notion of a random-access iterator, except that you cannot offset
> such an iterator by an integer to obtain a new iterator.
> 
> Such differences can have surprisingly profound effects on programs.

Sure, but that doesn't mean that Python doesn't have the concept of an
abstract interface simply because its model for collections (sequence
types, mapping types) is different than STL's.

It's not surprising that Python's approach to sequence types is more
dynamic and less restrictive than C++'s STL approach, since Python is
more dynamic and less restrictive than C++.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Can I walk with you / 'Till the day that the world stops turning
\__/  India Arie




More information about the Python-list mailing list