Message139958
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. |
|
Date |
User |
Action |
Args |
2011-07-06 22:59:51 | Ben.Wolfson | set | recipients:
+ Ben.Wolfson, mark.dickinson, eric.smith, eric.araujo, r.david.murray, petri.lehtinen |
2011-07-06 22:59:51 | Ben.Wolfson | set | messageid: <1309993191.49.0.608781080771.issue12014@psf.upfronthosting.co.za> |
2011-07-06 22:59:50 | Ben.Wolfson | link | issue12014 messages |
2011-07-06 22:59:50 | Ben.Wolfson | create | |
|