parse-time optimizations

jcm grumble at usa.net
Tue May 29 14:11:48 EDT 2001


Michael Hudson <mwh at python.net> wrote:

> Thing is, if you're writing code that benefits from constant folding -
> WHY?  If your code contains things like:

>     "a" + "b"

> then you have bigger problems than Python's lack of optimizations...

The example "a" + "b" was, of course, an example.  Something like

  "some really long string (probably longer than this one) that I " +
  "can't quite fit onto one line in good conscience"

would be more realistic.  There's also the case where code is
generated by another tool.  Somewhat relatedly, I've seen C macros
that generate expressions like

  1 + 1 + 1 + 1 + 1 + 1 + 0

so there are instances where this sort of thing comes up.



More information about the Python-list mailing list