On May 09, 2013 @ 01:51 pm, 
[email protected] wrote:

On 8 May 2013 23:00, Jagadeesh N. Malakannavar <[email protected]> wrote:
> I prefer to do it like this
>
>>>> a = list(str(3245325))
>>>> sum(map(int, a))
> 24

What does the map() gain you over basic list comprehension:
sum( [int(i) for i in '3245325'] )
ignoring any try/catch for int conversion errors

IMHO, this is easier to understand, more Pythonic, and likely
faster.

Regards,
Gora
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

________________________________
This is an automated response. Your issue has been noted. We'll be in touch 
soon.

Please reply to this email or visit the URL below with any additional details.

http://DB01:9675/portal/view-help-request/49

_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to