Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #67000
| Date | 2014-02-24 11:54 -0800 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Python 3.5, bytes, and %-interpolation (aka PEP 461) |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7328.1393271688.18130.python-list@python.org> (permalink) |
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~
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 11:54 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Marko Rauhamaa <marko@pacujo.net> - 2014-02-24 22:46 +0200
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) random832@fastmail.us - 2014-02-24 16:04 -0500
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Marko Rauhamaa <marko@pacujo.net> - 2014-02-25 00:18 +0200
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 23:55 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) wxjmfauth@gmail.com - 2014-02-25 00:07 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-25 08:29 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 13:53 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 23:55 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 16:10 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve@pearwood.info> - 2014-02-25 07:29 +0000
csiph-web