[issue22385] Define a binary output formatting mini-language for *.hex()

Robert report at bugs.python.org
Wed May 3 05:54:27 EDT 2017


Robert added the comment:

regarding the proposal for mini format languages for bytes (msg292663):
Wouldn't it be more consistent if the format specifiers are identical to the one of int's (see https://docs.python.org/3/library/string.html#format-specification-mini-language).

I.e. "X" / "x" for hex, "o" for octal, "d" for decimal, "b" for binary, "c" for character (=default). Only 'A' need to be added for printing only ascii characters.

Furthermore I cannot see in how far the format spec in http://bugs.python.org/issue22385#msg292663 ("h#,1") is more intuitive than in http://bugs.python.org/issue22385#msg226733 ("#,.4x"), which looks like the existing minilang.

Why does Python need a new format mini lang, if the existing one provides most of the requirements. As developer it is already hard to memorize the details of the existing minilang. Ideally I do not need to learn a similar but different one for bytes...

----------
nosy: +mrh1997

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


More information about the Python-bugs-list mailing list