Writing new codecs

Martin von Loewis loewis at informatik.hu-berlin.de
Sat Jun 16 21:02:23 CEST 2001

"Brian Quinlan" <brian at sweetapp.com> writes:

> My question is regarding form: should new codecs be written in C or
> Python? 

It's really your choice. For rarely-used encodings, writing them in
Python might make them more maintainable. But then, dealing with
individual bytes in C is often easier than in Python.

> AFAIK, Python does not currently include any codecs written in Python
> (I'm not counting the character mapping ones or the trivial wrappers
> around C code). Is this because the current codecs are all "important"
> and future codecs should be implemented elsewhere to avoid adding too
> much junk to codecmodule.c and unicodeobject.c? 
> Or is the pattern of providing the actual implementation in
> unicodeobject.c going to continue?

I hope not. New codecs should certainly use their own modules, which
still leaves the question whether these should be C or Python modules.


More information about the Python-list mailing list