diff options
author | Georg Brandl <georg@python.org> | 2009-04-12 15:51:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-12 15:51:51 (GMT) |
commit | abc387747dc573e05a4b31387797a0272062b2ef (patch) | |
tree | c12c0a0e45cb06edb87798a7831b1c8f79033015 /Lib/string.py | |
parent | 78532baeabc4234e3894c775f2bb7e0a21c12e0e (diff) | |
download | cpython-abc387747dc573e05a4b31387797a0272062b2ef.zip cpython-abc387747dc573e05a4b31387797a0272062b2ef.tar.gz cpython-abc387747dc573e05a4b31387797a0272062b2ef.tar.bz2 |
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.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/string.py b/Lib/string.py index ea0d359..8667c0e 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)): |