Eric V. Smith added the comment:

I'm not particularly wild about the .precision syntax either, but I think the 
feature is generally useful.

Adding bytes.__format__ is exactly what "special output for bytes" _is_, as far 
as format() is concerned.

Another option would be to invent a new format specification for bytes. There's 
no reason it needs to follow the same syntax as for str, int, etc., except for 
ease of remembering the syntax, and some code reuse.

For example, although it's insane, you could do:

format(b'abcdwxyz', 'use_spaces,grouping=4,add_prefix')
  -> '0x61626364 0x7778797a'

----------

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

Reply via email to