Madhusudan Singh <[EMAIL PROTECTED]> wrote:
   ...
> >> Say I have two lists of floats. And I wish to generate a list of floats
> >> that is a user defined function of the two lists.
> > 
> > result = [sqrt(x**2 + y**2) for x, y in zip(xs, ys)]
> 
> Works perfectly. Thanks !

If zip works and map doesn't, most likely your problem is that the two
lists have different lengths.  In this case, zip truncates to the
shorter list, while map conceptually extends the shorter list with
copies of None -- causing an error when you try to do arithmetic between
a float towards the end of the longer list, and None...!


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to