Em Dom, 2006-02-12 às 23:51 -0500, Steve Holden escreveu: > The basic answer is that so far no developer has felt it worthwhile to > expend time on adding these optimizations.
I always thought these small optimizations could lead Python to be faster overall. I remember about this every time I see CPython vs. IronPython benchmarks (.NET and Mono do some nice optimizations at compile and run times). > > Also, IIRC Psyco does optimize these constant expressions. Or am I > > wrong? > > > Psyco does some very advanced things, but it does them all at run-time. > Unless I misunderstand (not unheard of), there are no circumstances > under which Psyco will improve run-time for a piece of code that is only > executed once. Sorry, I think I should have been clearer. Yes, Psyco only helps at runtime (when the function is called), but those constant folds only practically help on parts of the code that are called many times anyway, right? -- "Quem excele em empregar a força militar subjulga os exércitos dos outros povos sem travar batalha, toma cidades fortificadas dos outros povos sem as atacar e destrói os estados dos outros povos sem lutas prolongadas. Deve lutar sob o Céu com o propósito primordial da 'preservação'. Desse modo suas armas não se embotarão, e os ganhos poderão ser preservados. Essa é a estratégia para planejar ofensivas." -- Sun Tzu, em "A arte da guerra" -- http://mail.python.org/mailman/listinfo/python-list