At 08:19 AM 4/9/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> >     lstNums = []
> >     for x in lstSvg:
> >         num = int(x.split('.')[0])
> >         lstNums.append(num)
>
>This is exactly what a list comp does so you could rewrite it as:
>
>lstNums = [int(x.split('.')[0]) for x in lstSvg]
>
>One of the cases where I actually think a list comprehension
>is more readable than the expanded code.

Thanks, Alan. I'll use it.

> >     nextSVGnum = max(lstNums) + 1
> >     return nextSVGnum

Dick


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to