Faster Python charmap codec decode and encode in Pyrex


Download fastcharmap source tarball

fastcharmap i686 binary tarball

fastcharmap Source RPM

fastcharmap i386 binary RPM

fastcharmap i386 debuginfo RPM

GPG key


This is my first Python package and there may be bugs!

Fastcharmap is a Python module that makes charmap codec translations about 5 times faster than the base charmap codecs. Charmap codecs are used for 8-bit character sets. Fastcharmap inserts faster code that works when unicode() or "".encode are called. Installation requires a binary distribution or a C compiler; Pyrex 0.9.3 is required for changes to the source.

Python's developers are working on faster charmap codecs for a future version of Python. Fastcharmap may be useful until then, and should simply do nothing in that version.


Fastcharmap can be installed from a normal Python source or binary tarball, or from a source or i386 RPM. From tarball:

$ tar xfvz fastcharmap-<version>.tar.gz
$ cd fastcharmap-<version>
$ su -
# python install


>>> import fastcharmap
>>> fastcharmap.hook('codec_name')

That codec will now automatically use fastcharmap. Other codecs will still function normally.

As fastcharmap is an extension module, not part of Python and requiring binary code, it may not be available for your program. In a program of mine, I handle that this way:

    import fastcharmap
except ImportError:
    print "fastcharmap not available"

To view the documentation, use the usual Python help command or Pydoc:

>>> import fastcharmap
>>> help(fastcharmap)

$ pydoc fastcharmap

To run the built-in tests (no output on success):

$ python


Back to Tony NelsonJHC's R Pentomino's Home Page

Valid HTML 4.0!