This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bakuriu
Recipients asvetlov, bakuriu, eric.smith, r.david.murray, vstinner
Date 2013-08-19.13:04:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376917485.3.0.967725176304.issue18750@psf.upfronthosting.co.za>
In-reply-to
Content
Note that the documentation for formatting with %, found here: http://docs.python.org/2/library/stdtypes.html#string-formatting-operations,  states:

"""
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)."""

Note how it explicitly states that in an expression: format % value there are two different cases:

 - If format contains *exactly one* format specifier, then value can be any non-tuple item and it will be formatted as is. Otherwise, value MUST be either tuple or a mapping.

In your example '' contains 0 format specifiers, hence you MUST use either a tuple or a dict. Any other object triggers "undefined behaviour"(in particular depending on whether the object define __geitem__ or not the formatting might or might not raise an exception etc.)

AFAIK only few people know this, hence changing the code could potentially break a lot of code for apparently no reason.
Since people should start to move to str.format instead of % this wart may not be worth fixing.
History
Date User Action Args
2013-08-19 13:04:45bakuriusetrecipients: + bakuriu, vstinner, eric.smith, r.david.murray, asvetlov
2013-08-19 13:04:45bakuriusetmessageid: <1376917485.3.0.967725176304.issue18750@psf.upfronthosting.co.za>
2013-08-19 13:04:45bakuriulinkissue18750 messages
2013-08-19 13:04:44bakuriucreate