[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

Guido van Rossum guido at python.org
Thu Mar 27 18:29:54 CET 2014


I also don't understand why we can't use %b instead of %s. AFAIK %b
currently doesn't mean anything and I somehow don't expect we're likely to
add it for other reasons (unless there's a proposal I'm missing?). Just
like we use %a instead of %r to remind people that it's not quite the same
(since it applies .encode('ascii', 'backslashreplace')), shouldn't we use
anything *but* %s to remind people that that is also not the same (not at
all, in fact)? The PEP's argument against %b ("rejected as not adding any
value either in clarity or simplicity") is hardly a good reason.


On Thu, Mar 27, 2014 at 10:20 AM, Guido van Rossum <guido at python.org> wrote:

> Actually, I had ignored this discussion for so long that I was surprised
> by the outcome. My main use case isn't printing a number that may already
> be a string (I understand why that isn't reasonable when the output is
> expected to be bytes); it's printing a usually numeric value that may
> sometimes be None. It's a little surprising to have to use %a for this, but
> I guess I can live with it.
>
>
> On Thu, Mar 27, 2014 at 8:58 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>
>> On 03/27/2014 04:42 AM, Nick Coghlan wrote:
>>
>>>
>>> I also seem to recall Guido saying he liked it [%a], which flipped the
>>>
>>> discussion from "do we have a good rationale for including it?" to "do
>>> we have a good rationale for the BDFL to ignore his instincts?".
>>> However, it would be up to Guido to confirm that recollection, and if
>>> "Guido likes it" is part of the reason for inclusion of the %a code,
>>> the PEP should mention that explicitly.
>>>
>>
>> I checked Guido's posts (Subject contains PEP 461, From contains guido)
>> and did not see anything to that effect.
>>
>> --
>> ~Ethan~
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev at python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
>> guido%40python.org
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140327/5e0e39d6/attachment-0001.html>


More information about the Python-Dev mailing list