[New-bugs-announce] [issue15801] Weird string interpolation behaviour

Erik Allik report at bugs.python.org
Tue Aug 28 23:06:22 CEST 2012

New submission from Erik Allik:

>>> class Foo(object):
...     pass
>>> "asdads" % Foo()

Doesn't look like it's supposed to be this way.

As per the documentation:

"If format requires a single argument, values may be a single non-tuple object. [5] Otherwise, values must be a tuple with exactly the number of items specified by the format string, or a single mapping object (for example, a dictionary)."

Tested and confirmed on 2.5, 2.6, 2.7 (both old and new style classes) and 3.2.

messages: 169300
nosy: eallik
priority: normal
severity: normal
status: open
title: Weird string interpolation behaviour
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list