[issue35546] String formatting produces incorrect result with left-aligned zero-padded format

2018-12-20 Thread Eric V. Smith
Eric V. Smith added the comment: I think this falls in to the consenting adults category. You can also do things like: >>> format(42, '->3') '-42' But why bother preventing this? It is unfortunate that %-formatting and .__format__() are different in this regard, but at this point I

[issue35546] String formatting produces incorrect result with left-aligned zero-padded format

2018-12-20 Thread Matthew Barnett
Matthew Barnett added the comment: A similar issue exists with centring: >>> format(42, '^020') '0420' -- nosy: +mrabarnett ___ Python tracker ___

[issue35546] String formatting produces incorrect result with left-aligned zero-padded format

2018-12-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Compare printf-style string formatting and new-style string formatting. >>> '%-020d' % 42 '42 ' >>> format(42, '<020') '4200' >>> format(42, '<020d') '4200' >>> '%-020x' % 42 '2a ' >>>