Is Python growing?

Steve Holden sholden at holdenweb.com
Fri Jun 28 09:53:42 EDT 2002


"Paul Rubin" <phr-n2002b at NOSPAMnightsong.com> wrote ...
> Matthew Dixon Cowles <matt at mondoinfo.com> writes:
> > On the other hand, some features make Python much easier to use and
> > read. A while ago, I replaced:
> >
> > def lengthOfLongestStr(list):
> >   l=len(list[0])
> >   for count in range(1,len(list)):
> >     if len(list[count])>l:
> >       l=len(list[count])
> >   return l
> >
> > with
> >
> > def lengthOfLongestStr(myList):
> >   return max([len(s) for s in myList])
> >
> > To my eye, the second one is much easier to read.
>
> Well, you could have said
>
>     def lengthOfLongestStr(myList):
>       return max (map (len, myList))
>
> without needing any new features added.

NOW you tell him.

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list