Python 3.5, bytes, and %-interpolation (aka PEP 461)
steve at pearwood.info
Tue Feb 25 08:29:49 CET 2014
On Mon, 24 Feb 2014 16:10:53 -0800, Ethan Furman wrote:
> On 02/24/2014 03:55 PM, Steven D'Aprano wrote:
>> Will b'%s' take any arbitrary object, as in:
>> b'Key: %s' % [1, 2, 3, 4]
>> => b'Key: [1, 2, 3, 4]'
Very glad to hear it.
>>> Can anybody think of a use-case for this particular feature?
>> Not me.
> I find that humorous, as %a would work with your list example above. :)
I know. But why would I want to do it? "It won't fail" is not a use-case.
I can subclass int and give it a __getitem__ method that raise SystemExit,
but that's not a use-case for doing so :-)
I cannot think of any reason to want to ASCII-ise the repr of arbitrary
objects, and on the rare occasion that I did, I could say
I don't object to this feature, but nor do I want it.
More information about the Python-list