[New-bugs-announce] [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>

More information about the New-bugs-announce mailing list