A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-January/131466.html below:

[Python-Dev] PEP 460 reboot

[Python-Dev] PEP 460 rebootDonald Stufft donald at stufft.io
Mon Jan 13 23:31:33 CET 2014
On Jan 13, 2014, at 5:25 PM, Eric V. Smith <eric at trueblade.com> wrote:

> On 1/13/2014 4:59 PM, Guido van Rossum wrote:
>> On Mon, Jan 13, 2014 at 1:29 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
>>> If somehow (unlikely though it seems) we end up keeping %s (e.g.
>>> strictly to ease porting), we could also keep %r as an alias for %a.
>>> 
>>> 
>>> %s for strictly interpolating bytes eases porting. Sad name, but good for
>>> compatibility. When the blowup happens, due to having a str type passed, the
>>> porter adds the appropriate .encode(...) to the parameter, so it doesn't
>>> blow up on Py 3, and it'll be OK for Py 2 as well, will it not?
>> 
>> Lots of code uses %s with numbers too, and probably the occasional
>> None or list (relying on the Python 2 near-guarantee that most
>> objects' str() is their repr() and that repr() nearly guarantees to
>> return only ASCII).
>> 
>> E.g. I'm sure you can find live code doing something like
>> 
>> headers.append('Content-Length: %s\r\n' % len(body))
>> 
> 
> That's why I think we should support %s taking bytes, int, float. And
> make %b mean the same thing, if you want. But I think we need to keep %s
> (however limited) for compatibility with Python 2.
> 
> Personally, I'd be okay with %s not accepting str (by raising an exception).
> 
> I think that would give us a large "compatibility surface" in common
> with Python 2.

%s not accepting str is the major thing I’d personally be against. %s taking numeric
types and bytes would be fine. The main thing i’d be worried about is where the RHS
may possibly contain something non ASCII that needs encoding (such as the str case).


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140113/b8cba3ce/attachment.sig>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4