Serhiy Storchaka added the comment: Inconsistency is a weak argument. It itself is not enough to add a new feature. str.translate() accepts a mapping instead of a string (as it would be for consistency with bytes.translate()) because it would be inconvenient to provide a 1114112-character string. str.maketrans() just compile a mapping in the optimized representation, because using a general mapping is not very efficient.
A bytes object of length 256 already is the most efficient representation of the translation table for bytes. And you can create it from a mapping in Python: def mymaketrans(mapping): table = bytearray(range(256)) for x, y in mapping.items(): table[x] = y return table ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31594> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com