Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'subject:PEP': 0.07; 'accepted,': 0.09; 'ascii': 0.09; 'assuming': 0.09; 'encode': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'pep': 0.09; '~ethan~': 0.09; 'python': 0.11; 'repr': 0.16; 'discussion': 0.18; 'header:User- Agent:1': 0.23; 'bytes': 0.24; 'skip:% 10': 0.24; '(or': 0.24; 'points': 0.29; 'code': 0.31; 'subject:skip:i 10': 0.31; 'anybody': 0.35; 'convert': 0.35; 'add': 0.35; 'should': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:173': 0.61; 'back': 0.62; 'debate': 0.68; 'greetings!': 0.84; 'do:': 0.91 Date: Mon, 24 Feb 2014 11:54:54 -0800 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Python Subject: Python 3.5, bytes, and %-interpolation (aka PEP 461) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:49441 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 3 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393271688 news.xs4all.nl 2967 [2001:888:2000:d::a6]:56276 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67000 Greetings! A PEP is under discussion to add %-interpolation back to the bytes type in Python 3.5. Assuming the PEP is accepted, what *will* be added back is: Numerics: b'%d' % 10 --> b'10' b'%02x' % 10 --> b'0a' Single byte: b'%c' % 80 --> b'P' and generic: b'%s' % some_binary_blob --> b'tHE*&92h4' (or whatever) What is under debate is whether we should also add %a: b'%a' % some_obj --> b'some_obj_repr' What %a would do: get the repr of some_obj convert it to ascii using backslashreplace (to handle any code points over 127) encode to bytes using 'ascii' Can anybody think of a use-case for this particular feature? -- ~Ethan~