[docs] [issue15660] Clarify 0 prefix for width specifier in str.format doc,

Eric V. Smith report at bugs.python.org
Wed Mar 16 17:03:02 EDT 2016


Eric V. Smith added the comment:

> '''
> When no explicit alignment is given, preceding the width field by a zero ('0') character enables sign-aware zero-padding for numeric types. This is equivalent to a fill character of '0' with an alignment type of '='.
> '''

I think that's good.

> I presume the problem with changing the error message is that it is not immediately known that alignment was set implicitly, by 0 before decimal width, rather than explicitly.  If the spec string is still available, it could be searched and the message adjusted if '=' is not present.  That proposal should be a new issue if someone wants to push it.

Yes, that's the problem. I guess it would be easier to keep track of
which fields were set via defaults, and which explicitly. Currently,
that information is lost.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15660>
_______________________________________


More information about the docs mailing list