Message303056
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 |
|
Date |
User |
Action |
Args |
2017-09-26 17:17:57 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, oleksandr.suvorov |
2017-09-26 17:17:57 | serhiy.storchaka | set | messageid: <1506446277.04.0.489664107577.issue31594@psf.upfronthosting.co.za> |
2017-09-26 17:17:57 | serhiy.storchaka | link | issue31594 messages |
2017-09-26 17:17:56 | serhiy.storchaka | create | |
|