[issue27506] make bytes/bytearray delete a keyword argument

Martin Panter report at bugs.python.org
Thu Aug 11 19:48:21 EDT 2016


Martin Panter added the comment:

I agree it would be worth checking for a slowdown.

As well as giving the option of omitting the table argument, it would make call sites easier to read. It would avoid suggesting that the first argument is translated to the second, like maketrans().

data = data.translate(YENC_TABLE, delete=b"\r\n")

Translate() already accepts None as the first argument; this is not new:

>>> b"hello".translate(None, b"l")
b'heo'

I guess the optional group was used as a way of making the second argument optional without a specific default value.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27506>
_______________________________________


More information about the Python-bugs-list mailing list