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
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com