A Standard

Andrew Koenig ark at research.att.com
Sun May 25 20:28:33 EDT 2003


Sean> almost all of the STL is either a) implemented as Python objects
Sean> or b) better done a different way.  Supplying this crutch to C++
Sean> coders will just result in un-Pythonic code being written and
Sean> will actually slow down their learning.

STL incorporates an important idea that Python is only just beginning to
adopt, namely that of imposing an abstraction layer between containers
and the programs that deal with them.

Right now, the only such abstraction layer I can think of in Python is
that of iterators, which correspond roughly to C++'s input iterators.
I can't think of anything in Python that corresponds to C++'s output
iterators.

Of course, this observation begs the question of whether it is a good
idea to add something like output iterators (and the other C++ iterator
categories) to Python, or whether the problems solved by such iterators
are better solved in Python by other means.  For example, where C++ uses
output iterators, Python might be better off yielding a generator that
in turn yields the desired output sequence.

I think that finding the right kind of abstraction layer for Python is
an interesting research question.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list