[Python-ideas] Binary f-strings

Eric V. Smith eric at trueblade.com
Fri Oct 2 16:26:49 CEST 2015


On 10/02/2015 10:20 AM, Sven R. Kunze wrote:
> On 28.09.2015 03:23, Eric V. Smith wrote:
>> Here I suggest 'ascii'. Unfortunately, this would give an error if
>> __format__ returned anything with a char greater than 127. I think we've
>> learned that an API that only raises an exception with certain specific
>> inputs is fragile.
> 
> Could you be more specific here?

bf'{foo}'

Might succeed or fail, depending on what foo returns for __format__. If
foo is 'bar', it succeeds. If it's '\u1234', it fails.

But some of the other arguments are making me think bf'' is a bad idea,
so now I'm leaning towards not implementing it.

Eric.



More information about the Python-ideas mailing list