5 Oct
2005
5 Oct
'05
6:47 a.m.
Tony Nelson wrote:
But is there really no way to say this fast in pure Python? The way a one-to-one byte mapping can be done with "".translate()?
Well, .translate isn't exactly pure Python. One-to-one between bytes and Unicode code points simply can't work. Just try all alternatives yourself and see if you can get any better than charmap_decode. Some would argue that charmap_decode *is* fast. Regards, Martin