From abc387747dc573e05a4b31387797a0272062b2ef Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 12 Apr 2009 15:51:51 +0000 Subject: Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecate string.maketrans() which actually works on bytes. (Also closes #5675.) --- Lib/string.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/string.py') 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)): -- cgit v1.2.1