Skip to content

10.1 bytes.maketrans() / str.translate() signature mix-up #35

Description

@wildekat

In section 10.1, Table 10.1 "Operations on Bytes and Bytearrays":

s.maketrans(x [, y [, z]]) Makes a translation table for s.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 table table, removing characters in deletechars.

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, /)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions