Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9ee9ada4
Commit
9ee9ada4
authored
Jun 28, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove string.maketrans
parent
9ebbf8aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
22 deletions
+2
-22
Lib/string.py
Lib/string.py
+0
-22
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/string.py
View file @
9ee9ada4
...
...
@@ -40,28 +40,6 @@ def capwords(s, sep=None):
return (sep or ' ').join([x.capitalize() for x in s.split(sep)])
# Construct a translation map for bytes.translate
def maketrans(frm: bytes, to: bytes) -> bytes:
"""
maketrans
(
frm
,
to
)
->
bytes
Return
a
translation
table
(
a
bytes
object
of
length
256
)
suitable
for
use
in
bytes
.
translate
where
each
byte
in
frm
is
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, 2)
if len(frm) != len(to):
raise ValueError("maketrans arguments must have same length")
if not (isinstance(frm, bytes) and isinstance(to, bytes)):
raise TypeError("maketrans arguments must be bytes objects")
L = bytearray(range(256))
for i, c in enumerate(frm):
L[c] = to[i]
return bytes(L)
####################################################################
import re as _re
...
...
Misc/NEWS
View file @
9ee9ada4
...
...
@@ -17,6 +17,8 @@ Core and Builtins
Library
-------
- The deprecated function string.maketrans has been removed.
Build
-----
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment