[Python-Dev] PEP 460 reboot

Ethan Furman ethan at stoneleaf.us
Mon Jan 13 01:28:43 CET 2014


On 01/12/2014 03:55 PM, Guido van Rossum wrote:
> There's a lot of discussion about PEP 460 and I haven't read it all.
> Maybe you all have already reached the same conclusion that I have.

No, no agreement has been reached.  Your contribution is timely.


> PEP 460 itself currently rejects support for %d, AFAIK on the basis
> that bytes aren't necessarily ASCII. I think that's a misunderstanding
> of the intention of the bytes type.

> [...] this does not mean the bytes type isn't allowed to have a
> noticeable bias in favor of encodings that are ASCII supersets, even
> if not all bytes objects contain such data [...]

> IMO it's totally fine and consistent if b'%d' % 42 returns b'42' and
> also for b'{}'.format(42) to return b'42' [...]
>
> - byte literals: b'abc' (it's a syntax error to have a non-ASCII character here)
> - the upper() and lower() methods modify the ASCII letter positions
> - int(b'42') == 42, float(b'3.14') == 3.14

So if we allow the numeric modifiers [1], the only remaining question is do we allow %c and %s, and if so how do they 
behave?

Guido?

--
~Ethan~


[1] modifiers is not the right word for %i, %x, etc, is it?  What is the correct term?


More information about the Python-Dev mailing list