Antoine Pitrou added the comment: > bytes.translate() is much faster because it builds a C array of 256 > items to fast table lookup, whereas str.translate() requires a Python > dict lookup for each character, which is much slower.
It should be easy to devise a simple hash table for the common case of one-to-one translation (and also deletion). ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21118> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com