Mercurial > cpython-lru_cache-weakref
diff Lib/string.py @ 53094:4407e4d07084
Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecate
string.maketrans() which actually works on bytes. (Also closes #5675.)
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sun, 12 Apr 2009 15:51:51 +0000 |
| parents | 8f0a175f04be |
| children | 238502460795 |
line wrap: on
line diff
--- a/Lib/string.py Sun Apr 12 15:35:44 2009 +0000 +++ b/Lib/string.py Sun Apr 12 15:51:51 2009 +0000 @@ -49,6 +49,9 @@ 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)):
