This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients oleksandr.suvorov, serhiy.storchaka
Date 2017-09-26.17:17:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506446277.04.0.489664107577.issue31594@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-09-26 17:17:57serhiy.storchakasetrecipients: + serhiy.storchaka, oleksandr.suvorov
2017-09-26 17:17:57serhiy.storchakasetmessageid: <1506446277.04.0.489664107577.issue31594@psf.upfronthosting.co.za>
2017-09-26 17:17:57serhiy.storchakalinkissue31594 messages
2017-09-26 17:17:56serhiy.storchakacreate