summaryrefslogtreecommitdiff
path: root/Lib/string.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-04-12 15:51:51 +0000
committerGeorg Brandl <georg@python.org>2009-04-12 15:51:51 +0000
commitabc387747dc573e05a4b31387797a0272062b2ef (patch)
treec12c0a0e45cb06edb87798a7831b1c8f79033015 /Lib/string.py
parent78532baeabc4234e3894c775f2bb7e0a21c12e0e (diff)
downloadcpython-git-abc387747dc573e05a4b31387797a0272062b2ef.tar.gz
Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecate
string.maketrans() which actually works on bytes. (Also closes #5675.)
Diffstat (limited to 'Lib/string.py')
-rw-r--r--Lib/string.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/string.py b/Lib/string.py
index ea0d359002..8667c0ee69 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -49,6 +49,9 @@ def maketrans(frm: bytes, to: bytes) -> bytes:
mapped to the byte at the same position in to.
The strings frm and to must be of the same length.
"""
+ import warnings
+ warnings.warn("string.maketrans is deprecated, use bytes.maketrans instead",
+ DeprecationWarning)
if len(frm) != len(to):
raise ValueError("maketrans arguments must have same length")
if not (isinstance(frm, bytes) and isinstance(to, bytes)):