Is it possible to extend the QPY compiler to recognize: foo_var = '& quote only these two ampersands &' def test:xml(): '{0}'.format(foo_var) Currently the entire string object result ends up being quoted, where as the old string parameter replacement approach quotes only objects not marked quote-no-more. '%s' % foo_var I haven't started using the new .format() method in earnest but may be more interested in it if/when the changes to placeholders in 3.1 which allow implied positional arguements are back ported to > 2.6. http://docs.python.org/3.1/library/string.html#formatstrings