map/filter/reduce/lambda opinions and background unscientificmini-survey

Christopher Subich spam.csubich+block at block.subich.spam.com
Sun Jul 3 14:09:32 EDT 2005


Scott David Daniels wrote:
> egbert wrote:
>> How do you replace
>> map(f1,sequence1, sequence2)
>> especially if the sequences are of unequal length ?
>>
>> I didn't see it mentioned yet as a candidate for limbo,
>> but the same question goes for:
>> zip(sequence1,sequence2)
> 
> OK, you guys are picking on what reduce "cannot" do.
> The first is [f1(*args) for args in itertools.izip(iter1, iter2)]
> How to _you_ use map to avoid making all the intermediate structures?

Not quite -- zip an izip terminate at the shortest sequence, map extends 
the shortest with Nones.  This is resolvable by addition of an lzip (and 
ilzip) function in Python 2.5 or something.

And egbert's Chicken Littling with the suggestion that 'zip' will be 
removed.



More information about the Python-list mailing list