[Python-ideas] Stop displaying elements of bytes objects as printable ASCII characters in CPython 3

M.-A. Lemburg mal at egenix.com
Wed Sep 10 10:01:18 CEST 2014


On 10.09.2014 09:43, Nick Coghlan wrote:
> On 10 September 2014 17:36, M.-A. Lemburg <mal at egenix.com> wrote:
>> On 10.09.2014 09:04, Chris Lasher wrote:
>>> Why did the CPython core developers decide to force the display of
>>> ASCII characters in the printable representation of bytes objects in
>>> CPython 3?
>>
>> This wasn't forced. It's a simple consequence of turning the Python 2
>> 8-bit string type into the Python 3 bytes type while keeping breakage
>> to a pain level which doesn't have Python users skip Python 3 entirely ;-)
> 
> I believe you may be forgetting the pre-release period where there
> wasn't an immutable bytes types at all. It wasn't until PEP 3137 [1]
> was implemented that we got to the status quo for Python 3.

Oh, I do know. That was a path which was luckily quickly abandoned
as default bytes type :-)

Note that we now have PyByteArray C APIs in Python 3 for bytearray
objects. PyBytes C APIs are (mostly) the Python 2 PyString C APIs -
unlike what's listed in the PEP.

> Cheers,
> Nick.
> 
> P.S. I haven't forgotten my promise to try to put together a recipe
> for a cleaner wrapper around "memoryview(data).cast('c')", but it may
> be a while before I get back to the idea.
> 
> [1] http://www.python.org/dev/peps/pep-3137/
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 10 2014)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2014-09-19: PyCon UK 2014, Coventry, UK ...                 9 days to go
2014-09-27: PyDDF Sprint 2014 ...                          17 days to go
2014-09-30: Python Meeting Duesseldorf ...                 20 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-ideas mailing list