-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
docsDocumentation in the Doc dirDocumentation in the Doc direasyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
Description
Bug report
Bug description:
str.translate() by help() says it must be a string as shown below:
print(help("".translate))
table
Translation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.
But the byte strings with bytes.maketrans() and bytearray.maketrans() also work with str.translate()
as shown below:
table1 = bytes.maketrans(b"abc", b"xyz")
table2 = bytearray.maketrans(b"abc", b"xyz")
print("AaBbCc".translate(table1))
print("AaBbCc".translate(table2))
# AxByCz
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc direasyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
Projects
Status
Todo