On Sun, Jul 25, 2010 at 1:13 PM, Eric Smith <e...@trueblade.com> wrote:
> On 7/23/10 2:44 AM, Guido van Rossum wrote:
>>
>> Indeed, we meant b'...{}...{}...'.format(x, y). The problem is that it
>> can't invoke x.__format__() or y.__format__() since those will return
>> text strings instead of bytes. A proposed solution was to try
>> x.__bformat__() etc. Another proposed solution was to limit x and y to
>> a small set of common types and hard-code their meanings (e.g.
>> numbers, bytes, and dates).
>
> If there were an __bformat__ method, what would object.__bformat__() return?

Maybe self.__format__(..).encode('ascii')?  ...encode('utf-8') is a
tempting alternative as well.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to