<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 27, 2014 at 10:55 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 03/27/2014 10:29 AM, Guido van Rossum wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
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<br>
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<br>
%r to remind people that it's not quite the same (since it applies .encode('ascii', 'backslashreplace')), shouldn't we<br>
use anything *but* %s to remind people that that is also not the same (not at all, in fact)? The PEP's argument against<br>
%b ("rejected as not adding any value either in clarity or simplicity") is hardly a good reason.<br>
</blockquote>
<br></div>
The biggest reason to use %s is to support a common code base for 2/3 endeavors.</blockquote><div><br></div><div>But it's mostly useless for that purpose. In Python 2, in practice %s doesn't mean "string". It means "use the default formatting just as if I was using print." And in theory it also means that -- in fact "call __str__()" is the formal definition, and print is also defined as using __str__, and this is all intentional. (I also intended __str__ to be *mostly* the same as __repr__, with a specific exception for the str type itself. In practice some frameworks have adopted a different interpretation, making __repr__ produce something *more* "user friendly" than __str__ but including newlines, because some people believe the main use case for __repr__ is the interactive prompt. I believe this causes problems for some *other* uses of __repr__, such as for producing an "unambiguous" representation useful for e.g. logging -- but I don't want to be too bitter about it. :-)<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The biggest reason to not include %b is that it means binary number in format(); given that each type can invent it's own mini-language, this probably isn't a very strong argument against it.<br>
</blockquote><div><br></div><div>Especially since I can't imagine the spelling in format() includes '%'.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have moderate feelings for keeping %s as a synonym for %b for backwards compatibility with Py2 code (when it's appropriate).<br></blockquote></div><br></div><div class="gmail_extra">I think it's mere existence (with the restrictions currently in the PEP) would cause more confusion than that is worth.<br>
</div><div class="gmail_extra"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)
</div></div>