Re: [Python-Dev] python optimization

2005-09-16 Thread Neal Becker
One possible way to improve the situation is, that if we really believe python cannot easily support such optimizations because the code is too dynamic, is to allow manual annotation of functions. For example, gcc has allowed such annotations using __attribute__ for quite a while. This would

Re: [Python-Dev] python optimization

2005-09-16 Thread Nick Coghlan
Neal Becker wrote: One possible way to improve the situation is, that if we really believe python cannot easily support such optimizations because the code is too dynamic, is to allow manual annotation of functions. For example, gcc has allowed such annotations using __attribute__ for quite a

Re: [Python-Dev] python optimization

2005-09-15 Thread Aahz
On Thu, Sep 15, 2005, Neal Becker wrote: I use cpython. I'm accustomed (from c++/gcc) to a style of coding that is highly readable, making the assumption that the compiler will do good things to optimize the code despite the style in which it's written. For example, I assume constants are

Re: [Python-Dev] python optimization

2005-09-15 Thread Brett Cannon
On 9/15/05, Neal Becker [EMAIL PROTECTED] wrote: I use cpython. I'm accustomed (from c++/gcc) to a style of coding that is highly readable, making the assumption that the compiler will do good things to optimize the code despite the style in which it's written. For example, I assume

Re: [Python-Dev] python optimization

2005-09-15 Thread Greg Ewing
Brett Cannon wrote: I don't know to what extent these kind of optimizations are available to cpython. For example, are constant calculations removed from loops? If you mean ``2+3``, then yes. Actually, no. Constant folding *could* be done, but it currently isn't: def f(): ... return 2+3

Re: [Python-Dev] python optimization

2005-09-15 Thread Raymond Hettinger
[Neal Becker] I don't know to what extent these kind of optimizations are available to cpython. For example, are constant calculations removed from loops? [Brett Cannon] If you mean ``2+3``, then yes. [Greg Ewing] Actually, no. Constant folding *could* be done, but it currently isn't: