[Python-3000] PEP 3138- String representation in Python 3000

M.-A. Lemburg mal at egenix.com
Tue May 20 12:06:38 CEST 2008


On 2008-05-20 03:59, Greg Ewing wrote:
> M.-A. Lemburg wrote:
>> 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.
> 
> That doesn't preclude those modules exporting their
> functionality in the form of codecs having the standard
> codec interface.

Note that all codecs we currently have in Python are in fact
modules that you can import and use directly - even subclass
to provide more or altered functionality, e.g.

     from encodings import latin_1

will give you direct access to the Latin-1 codec.

You seem to be worried that the functionality is supposed
to be buried deep in some codec registry - that's not the
case.

The codec registry only takes care of finding a codec
interface given a name, nothing more.

Also note that I'm not suggesting to remove any of the
existing implementations of specialized interfaces for
e.g. compression or base64 encoding. The codecs for these
only use these interface without assimilating them :-)

> There are two independent issues here:
> 
> 1) Should the functionality be provided in the form
>    of a codec? (Yes, that's fine, IMO.)
> 
> 2) Should all codecs live in a central registry and
>    be callable via methods on strings and bytes?
>    (I'm not convinced that's the case.)

I think there's a misunderstanding here in how codecs work.

Codecs exist to provide a consistent and well-defined interface
to a wide range of encoding and decoding applications.

They are not trying to:

  * compete with specialized interfaces

  * replace specialized interfaces

  * hide specialized interfaces from the user

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 20 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


More information about the Python-3000 mailing list