[Python-Dev] Why can't I encode/decode base64 without importing a module? (original) (raw)

M.-A. Lemburg mal at egenix.com
Tue Apr 23 18:04:37 CEST 2013


On 23.04.2013 17:47, Guido van Rossum wrote:

On Tue, Apr 23, 2013 at 8:22 AM, M.-A. Lemburg <mal at egenix.com> wrote:

Just as reminder: we have the general purpose encode()/decode() functions in the codecs module:

import codecs r13 = codecs.encode('hello world', 'rot-13') These interface directly to the codec interfaces, without enforcing type restrictions. The codec defines the supported input and output types. As an implementation mechanism I see nothing wrong with this. I hope the codecs module lets you introspect the input and output types of a codec given by name?

At the moment there is no standard interface to access supported input and output types... but then: regular Python functions or methods also don't provide such functionality, so no surprise there ;-)

It's mostly a matter of specifying the supported type combinations in the codec documentation.

BTW: What would be a use case where you'd want to programmatically access such information before calling the codec ?

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Apr 23 2013)

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/


2013-04-17: Released eGenix mx Base 3.2.6 ... http://egenix.com/go43

::::: Try our mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/



More information about the Python-Dev mailing list