multirember&co

Paul Rubin http
Tue Apr 17 00:44:08 EDT 2007


bearophileHUGS at lycos.com writes:
> So I have tried to create two iterables for the fun function scanning
> seq once only, but I haven't succed so far (to do it I have tried to
> use two coroutines with the enhanced generators, sending el to one or
> to the other according to the value of x == el, this time I don't show
> my failed versions), do you have suggestions?

I think there is not any way short of using something like list or
tee, if you want both output iterators to be available simultaneously.
Say there are 17 occurrences of el in the input iterator.  The only
way to know this is to scan through the whole iterator.  But now all
of its elements have to be available again at the output.



More information about the Python-list mailing list