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 Ben.Wolfson
Recipients Ben.Wolfson, eric.araujo, eric.smith, mark.dickinson, petri.lehtinen, r.david.murray
Date 2011-07-06.22:59:50
SpamBayes Score 4.3677917e-10
Marked as misclassified No
Message-id <1309993191.49.0.608781080771.issue12014@psf.upfronthosting.co.za>
In-reply-to
Content
And here is a patch for Greg Ewing's proposal: http://mail.python.org/pipermail/python-dev/2011-June/111934.html

Again, decimal integers rather than any kind of integers are used.

Both patches alter the exceptions expected in various places in test_unicode's test_format:

"{0.}".format() raises a ValueError (because the format string is invalid) rather than an IndexError (because there is no argument)

"{0[}".format(), likewise.

"{0]}".format() raises a ValueError (because the format string is invalid) rather than a KeyError (because "0]" is taken to be the name of a keyword argument---meaning that the test suite was testing the actual behavior of the implementation rather than the documented behavior).

"{c]}".format(), likewise.

In this patch, "{0[{1}]}".format('abcdef', 4) raises a ValueError rather than a TypeError, because "{1}", being neither a decimalinteger nor an identifier, invalidates the replacement field.

Both patches also add tests for constructions like this:

"{[0]}".format([3]) --> '3'
"{.__class__}".format(3) --> "<type 'int'>"

This conforms with the documentation (and current behavior), since in it arg_name is defined to be optional, but it is not currently covered in test_format, that I could tell, anyway.
History
Date User Action Args
2011-07-06 22:59:51Ben.Wolfsonsetrecipients: + Ben.Wolfson, mark.dickinson, eric.smith, eric.araujo, r.david.murray, petri.lehtinen
2011-07-06 22:59:51Ben.Wolfsonsetmessageid: <1309993191.49.0.608781080771.issue12014@psf.upfronthosting.co.za>
2011-07-06 22:59:50Ben.Wolfsonlinkissue12014 messages
2011-07-06 22:59:50Ben.Wolfsoncreate