Re: Python's only one way to do it philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
Steven D'Aprano [EMAIL PROTECTED] writes: On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: As for why tail calls are not optimized out, it was decided that being able to

Re: Python's only one way to do it philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
Anders J. Munch [EMAIL PROTECTED] writes: Like Steven said, tail-call optimisation is not necessary as you can always hand-optimise it yourself. Care to demonstrate on some code written in CPS (a compiler or parser, say)? 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's only one way to do it philosophy isn't good?

2007-06-12 Thread John Nagle
Alexander Schmolck wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Don't keep us in suspense. What do you believe is the true reason? It's easier to spot that some rationalization is

Re: Python's only one way to do it philosophy isn't good?

2007-06-12 Thread Steve Howell
--- John Nagle [EMAIL PROTECTED] wrote: There's a real reason. Remember, functions are dynamically replaceable. The compiler would have to detect that the function doesn't modify or replace itself while recursing for this optimization to be valid. Worst case, another thread could

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-11 Thread Josiah Carlson
John Nagle wrote: Josiah Carlson wrote: [snip] Constant folding happens regardless of optimization level in current Pythons. So really, assert and docstring removals. Eh. It's hard to optimize Python code well without global analysis. The problem is that you have to make sure that a

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Josiah Carlson
Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: Not tail calls, in general, no. Sorry, how does that work? You're suggesting that there is an algorithm which the compiler could follow to optimize away tail-recursion, but human beings can't follow the same algorithm? Now I'm

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-11 Thread Diez B. Roggisch
It's hard to optimize Python code well without global analysis. The problem is that you have to make sure that a long list of wierd things, like modifying code or variables via getattr/setattr, aren't happening before doing significant optimizations. Without that, you're doomed to a slow

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Bruno Desthuilliers
Terry Reedy a écrit : [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Terry Reedy wrote: | In Python, you have a choice of recursion (normal or tail) [snip Stroud questions] | I'm afraid Terry is wrong here, at least if he meant that CPython had | tail recursion

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Antoon Pardon
On 2007-06-09, Terry Reedy [EMAIL PROTECTED] wrote: WaterWalk [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | I've just read an article Building Robust System by Gerald Jay | Sussman. The article is here: |

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-11 Thread John Nagle
Diez B. Roggisch wrote: Regardless of the possibility of speeding it up - why should one want this? Coding speed is more important than speed of coding in 90%+ of all cases. When you have to start buying more servers for the server farm, it's a real pain. I'm actually facing that

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-11 Thread Steve Howell
--- John Nagle [EMAIL PROTECTED] wrote: When you have to start buying more servers for the server farm, it's a real pain. I'm actually facing that because Python's HTML parsing is so slow. I have been following this thread for a bit, but apologies in advance if I didn't read far

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Terry Reedy
| | Terry Reedy wrote: | | In Python, you have a choice of recursion (normal or tail) Bruno | I'm afraid Terry is wrong here, at least if he meant that CPython had | tail recursion *optimization*. | Terry Reedy a écrit : | NO!!! | I did not mean that or imply that in any way. Bruno | I

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Terry Reedy
Antoon Pardon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | On 2007-06-09, Terry Reedy [EMAIL PROTECTED] wrote: | For him to imply that Python is anti-flexibility is wrong. Very wrong.. | He should look in a mirror. See below. | | My impression is that python supporters often

Re: Python's only one way to do it philosophy isn't good?

2007-06-11 Thread Aahz
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: James Stroud [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Terry Reedy wrote: | In Python, you have a choice of recursion (normal or tail) | | Please explain this. I am working on a paper for Python Papers that

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-11 Thread Michele Simionato
On Jun 10, 6:43 pm, John Nagle [EMAIL PROTECTED] wrote: Josiah Carlson wrote: Steven D'Aprano wrote: On Sat, 09 Jun 2007 22:52:32 +, Josiah Carlson wrote: the only thing that optimization currently does in Python at present is to discard docstrings Python, or at least CPython,

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread [EMAIL PROTECTED]
On Jun 9, 12:16 pm, James Stroud [EMAIL PROTECTED] wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion, implying that python does

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread Josiah Carlson
Steven D'Aprano wrote: On Sat, 09 Jun 2007 22:52:32 +, Josiah Carlson wrote: the only thing that optimization currently does in Python at present is to discard docstrings Python, or at least CPython, does more optimizations than that. Aside from run-time optimizations like interned

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread John Nagle
[EMAIL PROTECTED] wrote: On Jun 9, 12:16 pm, James Stroud [EMAIL PROTECTED] wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion,

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-10 Thread John Nagle
Josiah Carlson wrote: Steven D'Aprano wrote: On Sat, 09 Jun 2007 22:52:32 +, Josiah Carlson wrote: the only thing that optimization currently does in Python at present is to discard docstrings Python, or at least CPython, does more optimizations than that. Aside from run-time

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Terry Reedy wrote: | In Python, you have a choice of recursion (normal or tail) [snip Stroud questions] | I'm afraid Terry is wrong here, at least if he meant that CPython had | tail recursion *optimization*. NO!!! I did not mean

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-10 Thread Steve Howell
--- John Nagle [EMAIL PROTECTED] wrote: With this, the heavy optimizations are possible. Strength reduction. Hoisting common subexpressious out of loops. Hoisting reference count updates out of loops. Keeping frequently used variables in registers. And elimination of many

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread Alexander Schmolck
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: As for why tail calls are not optimized out, it was decided that being able to have the stack traces (with variable information, etc.) was more useful than offering tail call optimization

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-10 Thread John Nagle
Steve Howell wrote: --- John Nagle [EMAIL PROTECTED] wrote: With this, the heavy optimizations are possible. Strength reduction. Hoisting common subexpressious out of loops. Hoisting reference count updates out of loops. Keeping frequently used variables in registers. And elimination of

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread Steven D'Aprano
On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: As for why tail calls are not optimized out, it was decided that being able to have the stack traces (with variable

Re: Python's only one way to do it philosophy isn't good?

2007-06-10 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: Not tail calls, in general, no. Sorry, how does that work? You're suggesting that there is an algorithm which the compiler could follow to optimize away tail-recursion, but human beings can't follow the same algorithm? Now I'm confused. The

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-10 Thread Kay Schluehr
On Jun 11, 12:43 am, Steve Howell [EMAIL PROTECTED] wrote: To the extent that some of these optimizations could be achieved by writing better Python code, it would nice for optimization tools to have a suggest mode. Is anyone out there who uses MS Word and doesn't deactivate the suggest mode

Re: Python optimization (was Python's only one way to do it philosophy isn't good?)

2007-06-10 Thread Steve Howell
--- Kay Schluehr [EMAIL PROTECTED] wrote: On Jun 11, 12:43 am, Steve Howell [EMAIL PROTECTED] wrote: To the extent that some of these optimizations could be achieved by writing better Python code, it would nice for optimization tools to have a suggest mode. Is anyone out there

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Gabriel Genellina
En Sat, 09 Jun 2007 02:49:03 -0300, WaterWalk [EMAIL PROTECTED] escribió: I've just read an article Building Robust System by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a footprint which says:

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Terry Reedy
WaterWalk [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | I've just read an article Building Robust System by Gerald Jay | Sussman. The article is here: | http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf | | In it there is a footprint which says: |

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread James Stroud
Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion, implying that python does not. Does python have fully optimized tail recursion as

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Cousin Stanley
In scheme, I believe you just have recursion. Cousin TJR I'm a total scheme rookie starting only about 3 days ago and one of the mechanisms I went looking for was a technique for iteration Found in the scheme docs about iteration supplied via the reduce

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Bjoern Schliessmann
Gabriel Genellina wrote: For what I can remember of my first love (Physics): if you have a small ball moving inside a spherical cup, it would be almost crazy to use cartesian orthogonal coordinates and Newton's laws to solve it - the obvious way would be to use spherical coordinates and the

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Kay Schluehr
On Jun 9, 12:16 pm, James Stroud [EMAIL PROTECTED] wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion, implying that python does

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Terry Reedy
James Stroud [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Terry Reedy wrote: | In Python, you have a choice of recursion (normal or tail) | | Please explain this. I am working on a paper for Python Papers that will. It was inspired by the question 'why doesn't Python do

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Terry Reedy
Cousin Stanley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | In scheme, I believe you just have recursion. I was referring to the original mimimalist core language developed by Guy and Sussman and as I remember it being used in the original edition of SICP (see Wikipedia). I

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread John Nagle
Bjoern Schliessmann wrote: Gabriel Genellina wrote: For what I can remember of my first love (Physics): if you have a small ball moving inside a spherical cup, it would be almost crazy to use cartesian orthogonal coordinates and Newton's laws to solve it - the obvious way would be to use

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Josiah Carlson
James Stroud wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion, implying that python does not. Does python have fully

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Alexander Schmolck
Josiah Carlson [EMAIL PROTECTED] writes: James Stroud wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion, implying that python

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Josiah Carlson
Alexander Schmolck wrote: Josiah Carlson [EMAIL PROTECTED] writes: James Stroud wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Steven D'Aprano
On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: As for why tail calls are not optimized out, it was decided that being able to have the stack traces (with variable information, etc.) was more useful than offering tail call optimization I don't buy this. Do you mean you don't

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread Steven D'Aprano
On Sat, 09 Jun 2007 22:52:32 +, Josiah Carlson wrote: the only thing that optimization currently does in Python at present is to discard docstrings Python, or at least CPython, does more optimizations than that. Aside from run-time optimizations like interned strings etc., there are a

Re: Python's only one way to do it philosophy isn't good?

2007-06-09 Thread James Stroud
Kay Schluehr wrote: On Jun 9, 12:16 pm, James Stroud [EMAIL PROTECTED] wrote: Terry Reedy wrote: In Python, you have a choice of recursion (normal or tail) Please explain this. I remember reading on this newsgroup that an advantage of ruby (wrt python) is that ruby has tail recursion,

Python's only one way to do it philosophy isn't good?

2007-06-08 Thread WaterWalk
I've just read an article Building Robust System by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a footprint which says: Indeed, one often hears arguments against building exibility into an engineered sys-

<    1   2   3