16 Sep
2014
16 Sep
'14
8:36 p.m.
On 09/16/2014 01:09 PM, Andrew Barnert wrote:
No, you're mixing up `format`, an explicit method on str that no one is suggesting adding to bytes, and `__format__`, a dunder method on every type that's used by `str.format` and `format`; the proposal is to extend `bytes.__format__` in some way that I don't think is entirely decided yet, but it would look something like this:
u'Hello, {:a}'.format(some_bytes_var) --> u'Hello, <whatever>'
Or:
u'Hello, {:#x}'.format(some_bytes_var) --> u'Hello, \\x2d\\x78\\x68\\x61...'
Ah, that makes more sense, thanks for the clarification! -- ~Ethan~