[BangPypers] [Ticket #49] Another qn. THanks for the basic of basic qn\

Prashant R. Naik prashant at triconinfotech.com
Thu May 9 10:23:48 CEST 2013

On May 09, 2013 @ 01:51 pm, bangpypers-bounces+prashant=triconinfotech.com at python.org wrote:

On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagadeesh at gmail.com> 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

BangPypers mailing list
BangPypers at python.org

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.


More information about the BangPypers mailing list