Iterator question

Andrew Koenig ark at research.att.com
Sat May 17 01:23:15 EDT 2003


Neal> I was wondering if python could imitiate the c++ stl copy function, using
Neal> python iterators.  It looks like the answer is no, because iterators only
Neal> support next(), and next returns an "rvalue", not an "lvalue", so there is
Neal> no way to assign through an iterator.  Is this correct?

Somehow you would need to externd the Python iterators to cover output.
One way of doing so, which would be very different from how C++ does it,
is to define algorithms that produce output by having them *return* an
iterator that the caller can then use.

This idea is only partly baked, and needs additional cooking in order
to be edible...

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




More information about the Python-list mailing list