"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Eg: >> a = 1 + 2 >> .vs. >> a = 3 >> which one is more effective? Does the compiler calculate the result at >> compile time? How about constant spreading? > > Algebraic optimizations aren't done AFAIK
Just try it: Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> dis.dis(lambda: 10+5) 1 0 LOAD_CONST 2 (15) 3 RETURN_VALUE -- http://mail.python.org/mailman/listinfo/python-list