[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Eric V. Smith
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

[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread STINNER Victor
STINNER Victor added the comment: > ".precision": chunks output, placing a space after every bytes I dislike this option. There is already "%.s" in Python 2 and Python 3 (and printf of the C language) which truncates the string. If you need such special output, please write your own function.

[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Eric V. Smith
Eric V. Smith added the comment: I think this would need to be implemented by adding bytes.__format__. I can't think of a way to make it work on bytes-like objects in general. -- ___ Python tracker ___

[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Ned Deily
Changes by Ned Deily : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-10 Thread Nick Coghlan
Changes by Nick Coghlan : -- title: Allow 'x' and 'X' to accept bytes objects in string formatting -> Allow 'x' and 'X' to accept bytes-like objects in string formatting ___ Python tracker