Re: [Tutor] lambda vs list comp

2010-07-27 Thread Steven D'Aprano
On Wed, 28 Jul 2010 02:44:02 am Jon Crump wrote: > Just as a matter of curiosity piqued by having to understand someone > else's code. Is the difference here just a matter of style, or is one > better somehow than the other? Remember that list comprehensions didn't exist until a few years ago, so

Re: [Tutor] lambda vs list comp

2010-07-27 Thread Rich Lovely
On 27 July 2010 17:53, Mac Ryan wrote: > On Tue, 2010-07-27 at 09:44 -0700, Jon Crump wrote: >> Just as a matter of curiosity piqued by having to understand someone >> else's code. Is the difference here just a matter of style, or is one >> better somehow than the other? >> >> >>> l >> [0, 1, 2, 3

Re: [Tutor] lambda vs list comp

2010-07-27 Thread Mac Ryan
On Tue, 2010-07-27 at 09:44 -0700, Jon Crump wrote: > Just as a matter of curiosity piqued by having to understand someone > else's code. Is the difference here just a matter of style, or is one > better somehow than the other? > > >>> l > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > >>> ','.join([str(

[Tutor] lambda vs list comp

2010-07-27 Thread Jon Crump
Just as a matter of curiosity piqued by having to understand someone else's code. Is the difference here just a matter of style, or is one better somehow than the other? >>> l [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> ','.join([str(x) for x in l]) '0,1,2,3,4,5,6,7,8,9,10' >>> ','.join(map(lambda x: