[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3
Terry Reedy
tjreedy at udel.edu
Sat Apr 12 19:19:42 CEST 2014
On 4/12/2014 11:08 AM, Augie Fackler wrote:
>
> On Mar 29, 2014, at 2:53 PM, Gregory P. Smith <greg at krypto.org
> <mailto:greg at krypto.org>> wrote:
>
>>
>> On Thu, Mar 27, 2014 at 3:05 PM, Antoine Pitrou <solipsis at pitrou.net
>> <mailto:solipsis at pitrou.net>> wrote:
>>
>> On Thu, 27 Mar 2014 18:47:59 +0000
>> Brett Cannon <bcannon at gmail.com <mailto:bcannon at gmail.com>> wrote:
>> > On Thu Mar 27 2014 at 2:42:40 PM, Guido van Rossum
>> <guido at python.org <mailto:guido at python.org>> wrote:
>> >
>> > > Much better, but I'm still not happy with including %s at all.
>> Otherwise
>> > > it's accept-worthy. (How's that for pressure. :-)
>> > >
>> >
>> > But if we only add %b and leave out %s then how is this going to
>> lead to
>> > Python 2/3 compatible code since %b is not in Python 2? Or am I
>> > misunderstanding you?
>>
>> I think we have reached a point where adding porting-related
>> facilities
>> in 3.5 may actually slow down the pace of porting, rather than
>> accelerate it (because people will then wait for 3.5 to start porting
>> stuff).
>>
>>
>> I understand that sentiment but that is an unjustified fear. It is not
>> a good reason not to do it. Projects are already trying to port stuff
>> today and running into roadblocks when it comes to ascii-compatible
>> bytes formatting for real world data formats in code needing to be 2.x
>> compatible. I'm pulling out my practicality beats purity card here.
>>
>> Mercurial is one of the large Python 2.4-2.7 code bases that needs
>> this feature in order to support Python 3 in a sane manner. (+Augie
>> Fackler to look at the latest
>> http://legacy.python.org/dev/peps/pep-0461/ to confirm usefulness)
>
> That looks sufficient to me - the biggest thing is being able to do
>
> "abort: %s is broken" % some_filename_that_is_bytes
>
> and have that work sanely, as well as the numerics. This looks like
> exactly what we need, but I'd love to test it soon (I'm happy to build a
> 3.5 from tip for testing) so that if it's not Right[0] changes can be
> made before it's permanent. Feel encouraged to CC me on patches or
> something for testing (or mail me directly when it lands).
Add yourself as nosy to http://bugs.python.org/issue20284
"patch to implement PEP 461 (%-interpolation for bytes)"
Indeed, you could help test it the latest version, and others as posted.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list