can list comprehensions replace map?

Paolino paolo.veronelli at gmail.com
Wed Jul 27 16:31:39 EDT 2005


David Isaac wrote:
> Newbie question:
> 
> I have been generally open to the proposal that list comprehensions
> should replace 'map', but I ran into a need for something like
> map(None,x,y)
> when len(x)>len(y).  I cannot it seems use 'zip' because I'll lose
> info from x.  How do I do this as a list comprehension? (Or,
> more generally, what is the best way to do this without 'map'?)

Probably zip should change behaviour,and cover that case or at least 
have another like 'tzip' in the __builtins__ .Dunno, I always thought 
zip should not cut to the shortest list.
> Thanks,
> Alan Isaac
> 
> 



More information about the Python-list mailing list