mwh at python.net
Tue May 29 15:01:14 EDT 2001
jcm <grumble at usa.net> writes:
> 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.
Well, there are other ways round that one; literal conatenation or
backslashing the newline.
> There's also the case where code is generated by another tool.
> Somewhat relatedly, I've seen C macros that generate expressions
> 1 + 1 + 1 + 1 + 1 + 1 + 0
> so there are instances where this sort of thing comes up.
True - but Python has no preprocessor so this is still fairly
unlikely. I don't think that many people machine generate Python -
but I could be wrong.
I don't want to discourage anyone from implementing these
optimizations for Python - but the benefit/effort ratio is rather
Academic politics is the most vicious and bitter form of politics,
because the stakes are so low. -- Wallace Sayre
More information about the Python-list