proposal: concatenation of iterators
Paul Rubin
phr-n2002b at NOSPAMnightsong.com
Mon Aug 12 10:59:44 EDT 2002
It would sure be useful sometimes to be able to say
a = iter((2, 3, 4))
b = iter((5, 6, 7))
for x in a + b: # concatenate two iterators
print x,
and get:
2 3 4 5 6 7
The implementation is obvious: a+b would just be a generator that
cycles through a and then b. Easy enough to code up with new-style
classes, but it seems natural enough that it should be built into
normal iterators.
Any thoughts? Is there already some simple way to do this?
More information about the Python-list
mailing list