[issue17068] peephole optimization for constant strings

Neal Norwitz report at bugs.python.org
Mon Jan 28 23:19:04 CET 2013


New submission from Neal Norwitz:

I was looking through code like this:

  foo = '%s%s%s' % ('https://', host, uri)

and realized this could be rewritten by the interpreter as:

  foo = 'https://%s%s' % (host, uri)

I tried to determine how much code this might affect, but it was pretty hard for me to come up with a decent regex to filter out all the false positives.  There were too many hits to determine if this would be used often.

----------
components: Interpreter Core
messages: 180885
nosy: nnorwitz
priority: normal
severity: normal
status: open
title: peephole optimization for constant strings
type: performance

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17068>
_______________________________________


More information about the Python-bugs-list mailing list