Pete Wicken <petewic...@gmail.com> added the comment:

Given the comments above I appreciate that this is actually due to the padding 
being the total field width rather than the padding of the digits themselves. 
Having revised the documentation again, I believe this following line is 
explaining it:

"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 '='."

(https://docs.python.org/3.8/library/string.html)

I initially read "sign-aware zero-padding for numeric types" to mean the 
padding would not blindly prepend, and would take into account any signs and 
pad after (hence initially making this a bug). So maybe as suggested above we 
should explicitly mention the padding is the total number of characters in the 
field, rather than just the numbers.

I can look into adding this soon and see what you all think.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38657>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to