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]' > > No. 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 repr(obj).encode('ascii', 'backslashescape') I don't object to this feature, but nor do I want it. -- Steven -- https://mail.python.org/mailman/listinfo/python-list