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

Noufal Ibrahim noufal at nibrahim.net.in
Thu May 9 04:02:03 CEST 2013


Gora Mohanty <gora at mimirtech.com> writes:

> 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'] )

You could drop the []. No need to first generate and then iterate over
the list.

[...]


-- 
Cordially,
Noufal
http://nibrahim.net.in


More information about the BangPypers mailing list