Paul Rubin wrote:

Steve Holden <[EMAIL PROTECTED]> writes:

You probably already know that sensible compiled language systems have
used constant folding since time immemorial, but Python has always
eschewed it. That's what comes of being a pragmatist's language: if
such optimizations really are required the programmer is expected to
perform them.


You mean the lack is deliberate?  I just figured it was an artifact of
the implementation and that PyPy had some reasonable chance of fixing it.

No, it's not been deliberately omitted, it's just not a development priority. Pragmatic Python programmers are prepared to do the folding themselves in the (exceptionally rare) cases where it has a significant effect on performance.


PyPy may or may not fix it. And, of course, a dynamic language has rather less ability to take advantage of more advanced optimizations since it's much harder to guarantee functional behavior for any given subexpression. Once side effects rear their ugly heads all bets are off.

regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to