Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 5c33ebb50702 by Eric V. Smith in branch 'default':
Improve exception text. Closes issue 13811.
http://hg.python.org/cpython/rev/5c33ebb50702
--
nosy: +python-dev
resolution: - fixed
stage: needs patch -
Eric V. Smith e...@trueblade.com added the comment:
Changing to 3.3: I don't think applying this to 3.2 would be appropriate.
--
assignee: - eric.smith
keywords: +easy
priority: normal - low
stage: - needs patch
title: In str.format an incorrect alignment option doesn't make fill char
py.user port...@yandex.ru added the comment:
Stefan Krah wrote:
Thus, if fill and align are absent, it does not mean that you can add
arbitrary characters like xx.
the descriptions says in other words:
if you have used an incorrect alignment option, then the interpreter behaves
like you
Stefan Krah stefan-use...@bytereef.org added the comment:
The text speaks about the regular case of a second character that
is not a valid alignment character, e.g.:
format(3.222, .2f)
Clearly the '2' fulfills this criterion, so the parser knows that the
leading '.' is *not* a fill
Eric V. Smith e...@trueblade.com added the comment:
As I look at it a little closer, I think I'm going to change the message to:
Invalid format type specified. The code has determined that instead of a type
that's a single character long, it's received xx10d. That's because xx
doesn't match
py.user port...@yandex.ru added the comment:
Stefan Krah wrote:
After it has been established that [[fill]align] is not present you have to
match the *whole string* with the rest of the grammar
I think, there should be a text in the documentation: if the alignment optiont
is invalid, it
Stefan Krah stefan-use...@bytereef.org added the comment:
Eric V. Smith rep...@bugs.python.org wrote:
As I look at it a little closer, I think I'm going to change the message to:
Invalid format type specified. The code has determined that instead of a
type that's a single character long, it's
Stefan Krah stefan-use...@bytereef.org added the comment:
Stefan Krah rep...@bugs.python.org wrote:
[xx10d]
look at the code now, but would the message also be raised for this spec?
format(9, xx10f)
Argh, 'd' is of course also a valid type specifier.
--
Eric V. Smith e...@trueblade.com added the comment:
The existing exceptions use the text format code for what the documentation
calls type:
format(9, h)
Traceback (most recent call last):
File stdin, line 1, in module
ValueError: Unknown format code 'h' for object of type 'int'
So to be