[Python-Dev] Unicode charmap decoders slow
Walter Dörwald
walter at livinglogic.de
Thu Oct 6 14:40:24 CEST 2005
M.-A. Lemburg wrote:
> [...]
>>Or we could have a function that recreates the dictionary from the string.
>
> Actually, I'd prefer that these operations be done by the
> codec generator script, so that we don't have additional
> startup time. The dictionaries should then no longer be
> generated and instead. I'd like the comments to stay, though.
> This can be done like this (using string concatenation
> applied by the compiler):
>
> decoding_charmap = (
> u'x' # 0x0000 -> 0x0078 LATIN SMALL LETTER X
> u'y' # 0x0001 -> 0x0079 LATIN SMALL LETTER Y
> ...
> )
I'd prefer that too.
> Either way, monkey patching the codec won't work anymore.
> Doesn't really matter, though, as this was never officially
> supported.
>
> We've always told people to write their own codecs
> if they need to modify an existing one and then hook it into
> the system using either a new codec search function or by
> adding an appropriate alias.
OK, so can someone update gencodec.py and recreate the charmap codecs?
BTW, is codecs.make_encoding_map part of the official API, or can we
change it to expect a string instead of a dictionary?
Bye,
Walter Dörwald
More information about the Python-Dev
mailing list