Wonderful discussion. Thanks for all replies. To my eyes map() looked better so just used it. Yes list comprehension is better idea.
Thanks On Thu, May 9, 2013 at 1:54 PM, <bangpypers-requ...@python.org> wrote: > Send BangPypers mailing list submissions to > bangpypers@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to > bangpypers-requ...@python.org > > You can reach the person managing the list at > bangpypers-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > > 1. Re: Another qn. THanks for the basic of basic qn\ > (Jagadeesh N. Malakannavar) > 2. Re: Another qn. THanks for the basic of basic qn\ (Gora Mohanty) > 3. Re: Another qn. THanks for the basic of basic qn\ (Noufal Ibrahim) > 4. A Comparison of Mocking Frameworks (Sriram Narayanan) > 5. Re: Another qn. THanks for the basic of basic qn\ (Gora Mohanty) > 6. [Ticket #27] A Comparison of Mocking Frameworks > (Prashant R. Naik) > 7. [Ticket #18] Another qn. THanks for the basic of basic qn\ > (Prashant R. Naik) > 8. [Ticket #29] Another qn. THanks for the basic of basic qn\ > (Prashant R. Naik) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 8 May 2013 23:00:40 +0530 > From: "Jagadeesh N. Malakannavar" <mnjagade...@gmail.com> > To: bangpypers@python.org > Subject: Re: [BangPypers] Another qn. THanks for the basic of basic > qn\ > Message-ID: > < > ca+lofsnd_amqaopsxn31sspfwdcloj8tuab7o8q82r1xjnt...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > I prefer to do it like this > > >>> a = list(str(3245325)) > >>> sum(map(int, a)) > 24 > >>> > > -- > > Thanks, > Jagadeesh N.Malakannavar > > > ------------------------------ > > Message: 2 > Date: Wed, 8 May 2013 23:37:11 +0530 > From: Gora Mohanty <g...@mimirtech.com> > To: Bangalore Python Users Group - India <bangpypers@python.org> > Subject: Re: [BangPypers] Another qn. THanks for the basic of basic > qn\ > Message-ID: > < > cacimrg+pkonbebv6r5htydpxres7n19e57mv_egwkworvny...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagade...@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 > faster. > > Regards, > Gora > > > ------------------------------ > > Message: 3 > Date: Thu, 09 May 2013 07:32:03 +0530 > From: Noufal Ibrahim <nou...@nibrahim.net.in> > To: Gora Mohanty <g...@mimirtech.com> > Cc: Bangalore Python Users Group - India <bangpypers@python.org> > Subject: Re: [BangPypers] Another qn. THanks for the basic of basic > qn\ > Message-ID: <87wqr8lxlw.fsf@sanitarium.localdomain> > Content-Type: text/plain > > Gora Mohanty <g...@mimirtech.com> writes: > > > On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagade...@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 > > > ------------------------------ > > Message: 4 > Date: Thu, 9 May 2013 08:36:16 +0530 > From: Sriram Narayanan <sriram...@gmail.com> > To: Bangalore Python Users Group - India <bangpypers@python.org> > Subject: [BangPypers] A Comparison of Mocking Frameworks > Message-ID: > < > caniy96azdbmwirgyjw6lfinmt0h-bweygqui4kdyh++mn4v...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi everyone: > > A colleague pointed me to this comparison of mocking frameworks: > http://garybernhardt.github.io/python-mock-comparison/ > > -- Sriram > ------------------------------------ > Belenix: www.belenix.org > Twitter: @sriramnrn > > > ------------------------------ > > Message: 5 > Date: Thu, 9 May 2013 10:42:34 +0530 > From: Gora Mohanty <g...@mimirtech.com> > To: Noufal Ibrahim <nou...@nibrahim.net.in> > Cc: Bangalore Python Users Group - India <bangpypers@python.org> > Subject: Re: [BangPypers] Another qn. THanks for the basic of basic > qn\ > Message-ID: > < > cacimrglmaj5_o6wyxyba62acmymtm8wyd55sk3zcqwsveva...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > On 9 May 2013 07:32, Noufal Ibrahim <nou...@nibrahim.net.in> wrote: > > Gora Mohanty <g...@mimirtech.com> writes: > > > >> On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagade...@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. > > Ah, yes! Forgot that the expression would act as a generator. > Good catch! > > Regards, > Gora > > > ------------------------------ > > Message: 6 > Date: Thu, 9 May 2013 08:22:00 +0000 > From: "Prashant R. Naik" <prash...@triconinfotech.com> > To: "bangpypers@python.org" <bangpypers@python.org> > Subject: [BangPypers] [Ticket #27] A Comparison of Mocking Frameworks > Message-ID: > <E728B7F635D6814A9049AC1C56B08D0C473F0CE9@MAIL.triconhome.local> > Content-Type: text/plain; charset="us-ascii" > > On May 09, 2013 @ 01:50 pm, bangpypers-bounces+prashant= > triconinfotech....@python.org wrote: > > Hi everyone: > > A colleague pointed me to this comparison of mocking frameworks: > http://garybernhardt.github.io/python-mock-comparison/ > > -- Sriram > ------------------------------------ > Belenix: www.belenix.org > Twitter: @sriramnrn > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > 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/27 > > > > ------------------------------ > > Message: 7 > Date: Thu, 9 May 2013 08:20:58 +0000 > From: "Prashant R. Naik" <prash...@triconinfotech.com> > To: "bangpypers@python.org" <bangpypers@python.org> > Subject: [BangPypers] [Ticket #18] Another qn. THanks for the basic of > basic qn\ > Message-ID: > <E728B7F635D6814A9049AC1C56B08D0C473F0AC8@MAIL.triconhome.local> > Content-Type: text/plain; charset="us-ascii" > > On May 09, 2013 @ 01:50 pm, bangpypers-bounces+prashant= > triconinfotech....@python.org wrote: > > On 9 May 2013 07:32, Noufal Ibrahim <nou...@nibrahim.net.in> wrote: > > Gora Mohanty <g...@mimirtech.com> writes: > > > >> On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagade...@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. > > Ah, yes! Forgot that the expression would act as a generator. > Good catch! > > Regards, > Gora > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > 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/18 > > > > ------------------------------ > > Message: 8 > Date: Thu, 9 May 2013 08:22:47 +0000 > From: "Prashant R. Naik" <prash...@triconinfotech.com> > To: "bangpypers@python.org" <bangpypers@python.org> > Subject: [BangPypers] [Ticket #29] Another qn. THanks for the basic of > basic qn\ > Message-ID: > <E728B7F635D6814A9049AC1C56B08D0C473F0DDF@MAIL.triconhome.local> > Content-Type: text/plain; charset="us-ascii" > > On May 09, 2013 @ 01:50 pm, bangpypers-bounces+prashant= > triconinfotech....@python.org wrote: > > Gora Mohanty <g...@mimirtech.com> writes: > > > On 8 May 2013 23:00, Jagadeesh N. Malakannavar <mnjagade...@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 > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > 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/29 > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > > > ------------------------------ > > End of BangPypers Digest, Vol 69, Issue 7 > ***************************************** > -- Thanks, Jagadeesh N.Malakannavar _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers