python-distilled
python-distilled copied to clipboard
10.1 bytes.maketrans() / str.translate() signature mix-up
In section 10.1, Table 10.1 "Operations on Bytes and Bytearrays":
s.maketrans(x [, y [, z]])Makes a translation table fors.translate().
For bytes and bytearray, maketrans() takes two arguments: maketrans(frm, to, /)
And further down, in Table 10.9 "String Operators and Methods", you have:
s.translate(table [, deletechars])Translates a string using a character translation tabletable, removing characters indeletechars.
According to the docs, the optional second parameter (delete) is a bytes/bytearray thing, while str.translate only takes one (mandatory) argument: translate(self, table, /)