[Python-3000] PEP 3138- String representation in Python 3000 (original) (raw)
M.-A. Lemburg mal at egenix.com
Mon May 19 19:36:44 CEST 2008
- Previous message: [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-3000] PEP 3138- String representation in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2008-05-19 19:19, Raymond Hettinger wrote:
[MAL]
It's being able to write
str.transform('gzip').transform('uu')
which doesn't require knowledge about the modules doing the actual work behind the scenes. What is the reverse operation for the above example: str.untransform('uu').untransform('gzip')?
Yes.
BTW: Since the codecs do bytes->bytes conversion, I should have written bytes.transform('gzip').transform('uu')
Why can't we use codecs and stick with the usual encode/decode methods?
That's what you can do in Python 2.x.
In Py 3.x, .encode() and .decode() have strict type requirements on their return types. .transform() and .untransform() return the same type, .encode() and .decode() return bytes and str resp.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, May 19 2008)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
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
- Previous message: [Python-3000] PEP 3138- String representation in Python 3000
- Next message: [Python-3000] PEP 3138- String representation in Python 3000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]