Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-24 Thread Chris Angelico
On Tue, Jan 24, 2012 at 5:44 PM, alex23 wrote: > On Jan 24, 4:56 am, 8 Dihedral > wrote: >> I know manny python programmers just abandon the list comprehension >> in non-trivial processes. > > Really? Observation of the python mailing list indicates the opposite: > people seem inclined to use

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread alex23
On Jan 24, 4:56 am, 8 Dihedral wrote: > 在 2012年1月23日星期一UTC+8上午2时01分11秒,Robert Kern写道: > >    [line.strip('\n') for line in f] > > This is more powerful by turning an object to be iterable. > But the list comprehension violates the basic operating > principle of the iteratee chaining rule in pr

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread 88888 Dihedral
在 2012年1月23日星期一UTC+8上午2时01分11秒,Robert Kern写道: > On 1/22/12 3:50 PM, Rick Johnson wrote: > > > > What does Python do when presented with this code? > > > > py> [line.strip('\n') for line in f.readlines()] > > > > If Python reads all the file lines first and THEN iterates AGAIN to do > > the strip;

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread Grant Edwards
On 2012-01-22, Rick Johnson wrote: > What does Python do when presented with this code? It does what you tell it to. What else would you expect? -- Grant Edwards grant.b.edwardsYow! Are we wet yet? at

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread Steven D'Aprano
On Sun, 22 Jan 2012 07:50:59 -0800, Rick Johnson wrote: > What does Python do when presented with this code? > > py> [line.strip('\n') for line in f.readlines()] > > If Python reads all the file lines first and THEN iterates AGAIN to do > the strip; we are driving a Fred flintstone mobile. Nons

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Michael Torrie
On 01/22/2012 06:04 PM, Rick Johnson wrote: > That's just the point. If an expert such as myself can make a simple > mistake as this, then one can only expect that the neophytes are going > to suffer greatly. I wonder how many tutorials are out there in WWW > still teaching old ways of writing Pyth

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Rick Johnson
On Jan 22, 6:38 pm, Michael Torrie wrote: > On 01/22/2012 08:50 AM, Rick Johnson wrote: > > > > > What does Python do when presented with this code? > > > py> [line.strip('\n') for line in f.readlines()] > > > If Python reads all the file lines first and THEN iterates AGAIN to do > > the strip; we

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Michael Torrie
On 01/22/2012 08:50 AM, Rick Johnson wrote: > > What does Python do when presented with this code? > > py> [line.strip('\n') for line in f.readlines()] > > If Python reads all the file lines first and THEN iterates AGAIN to do > the strip; we are driving a Fred flintstone mobile. If however Pyth

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Joshua Landau
On 22 January 2012 20:57, Michael Poeltl wrote: > > Two iterations. And since that is the only possible way to do this, you > > are correct, the language is terribly archaic. I suggest you switch to > > Ruby ASAP. > why there is only one possibility to do so? in a second i found this > ''.join(o

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Michael Poeltl
* Ian Kelly [2012-01-22 19:29]: > On Sun, Jan 22, 2012 at 8:50 AM, Rick Johnson > wrote: > > > > > What does Python do when presented with this code? > > > > py> [line.strip('\n') for line in f.readlines()] > > > > If Python reads all the file lines first and THEN iterates AGAIN to do > > the str

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Ian Kelly
On Sun, Jan 22, 2012 at 8:50 AM, Rick Johnson wrote: > > What does Python do when presented with this code? > > py> [line.strip('\n') for line in f.readlines()] > > If Python reads all the file lines first and THEN iterates AGAIN to do > the strip; we are driving a Fred flintstone mobile. If howev

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Robert Kern
On 1/22/12 3:50 PM, Rick Johnson wrote: What does Python do when presented with this code? py> [line.strip('\n') for line in f.readlines()] If Python reads all the file lines first and THEN iterates AGAIN to do the strip; we are driving a Fred flintstone mobile. If however Python strips each

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Heiko Wundram
Am 22.01.2012 16:50, schrieb Rick Johnson: What does Python do when presented with this code? py> [line.strip('\n') for line in f.readlines()] If Python reads all the file lines first and THEN iterates AGAIN to do the strip; we are driving a Fred flintstone mobile. If however Python strips eac

Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-22 Thread Rick Johnson
What does Python do when presented with this code? py> [line.strip('\n') for line in f.readlines()] If Python reads all the file lines first and THEN iterates AGAIN to do the strip; we are driving a Fred flintstone mobile. If however Python strips each line of the lines passed into readlines in