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

Ethan Furman ethan at stoneleaf.us
Fri Mar 28 23:47:18 CET 2014


On 03/27/2014 04:26 AM, Nick Coghlan wrote:
> On 27 March 2014 20:47, Victor Stinner <victor.stinner at gmail.com> wrote:
>> The PEP 461 looks good to me. It's a nice addition to Python 3.5 and
>> the PEP is well defined.
>
> +1 from me as well. One minor request is that I don't think the
> rationale for rejecting numbers from "%s" is complete [...]

Changed to
---------------------------------------------------------------------------------
In particular, ``%s`` will not accept numbers nor ``str``.  ``str`` is rejected
as the string to bytes conversion requires an encoding, and we are refusing to
guess; numbers are rejected because:

   - what makes a number is fuzzy (float? Decimal? Fraction? some user type?)

   - allowing numbers would lead to ambiguity between numbers and textual
     representations of numbers (3.14 vs '3.14')

   - given the nature of wire formats, explicit is definitely better than implicit
---------------------------------------------------------------------------------

>> Note: I fixed a typo in your PEP (reST syntax).
>
> I also committed a couple of markup tweaks, since it seemed easier to
> just fix them than explain what was broken.

Thanks to both of you for that.

> However, there are also
> two dead footnotes (4 & 5), which I have left alone - I'm not sure if
> the problem is a missing reference, or if the footnote can go away
> now.

Fixed.

--
~Ethan~


More information about the Python-Dev mailing list