[Python-Dev] 2.5 PEP
Nick Coghlan
ncoghlan at gmail.com
Thu Feb 16 12:06:59 CET 2006
Neal Norwitz wrote:
> On 2/15/06, Alain Poirier <alain.poirier at net-ng.com> wrote:
>> - isn't the current implementation of itertools.tee (cache of previous
>> generated values) incompatible with the new possibility to feed a
>> generator (PEP 342) ?
>
> I'm not sure what you are referring to. What is the issue?
The 'tee' object doesn't have a "send" method. (This is true for all of the
itertools iterators, I believe).
The request is misguided though - the itertools module is designed to operate
on output-only iterators, not on generators that expect input via send().
Because the output values might depend on the values sent, then it makes no
sense to cache them (or do most of the other things itertools does).
The relevant functionality would actually make the most sense as a fork()
method on generators, but PEP 342 was trying to be fairly minimalist.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list