User: Password:
Subscribe / Log in / New account

Re: PEP 460 reboot

From:  Guido van Rossum <>
To:  Ethan Furman <>
Subject:  Re: PEP 460 reboot
Date:  Sun, 12 Jan 2014 18:11:47 -0800
Message-ID:  <>
Cc:  Python Dev <>
Archive-link:  Article

On Sun, Jan 12, 2014 at 5:27 PM, Ethan Furman <> wrote:
> On 01/12/2014 04:47 PM, Guido van Rossum wrote:
>> %s seems the trickiest: I think with a bytes argument it should just
>> insert those bytes (and the padding modifiers should work too), and
>> for other types it should probably work like %a, so that it works as
>> expected for numeric values, and with a string argument it will return
>> the ascii()-variant of its repr(). Examples:
>> b'%s' % 42 == b'42'
>> b'%s' % 'x' == b"'x'" (i.e. the three-byte string containing an 'x'
>> enclosed in single quotes)
> I'm not sure about the quotes.  Would anyone ever actually want those in the
> byte stream?

Perhaps not, but it's a hint that you should probably think about an
encoding. It's symmetric with how '%s' % b'x' returns "b'x'". Think of
it as payback time. :-)

--Guido van Rossum (

(Log in to post comments)

Copyright © 2014, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds