On 06/01/14 13:24, Victor Stinner wrote: > Hi, > > bytes % args and bytes.format(args) are requested by Mercurial and [snip] I'm opposed to adding methods to bytes for this, as I think it goes against the reason for the separation of str and bytes in the first place. str objects are pieces of text, a list of unicode characters. In other words they have meaning independent of their context. bytes are just a sequence of 8bit clumps. The meaning of bytes depends on the encoding, but the proposed methods will have no encoding, but presume meaning. What does b'%s' % 7 do? u'%s' % 7 calls 7 .__str__() which returns a (unicode) string. By implication b'%s' % 7 would call 7 .__str__() and ... And then what? Use the "default" encoding? ASCII? Explicit is better than implicit. I am not opposed to adding new functionality, as long as it is not overloading the % operator or format() method. binascii.format() perhaps? Cheers, Mark.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4