May 20, 2020
10:28 a.m.
On Wed, May 20, 2020 at 2:46 AM Cameron Simpson <cs@cskk.id.au> wrote:
On 19May2020 15:43, David Mertz <mertz@gnosis.cx> wrote: Reiterating the Python 3.9 suggestion, what about:
salt2 = salt.cutsuffix(('==', '='))
Tuple arguments were rejected in the PEP. ``` Python 3.10.0a0 (heads/master:bac170cd93, May 20 2020, 12:20:34) [Clang 10.0.0 (clang-1000.11.45.5)] on darwin Type "help", "copyright", "credits" or "license" for more information.
'abc=='.removesuffix('=') 'abc=' 'abc=='.removesuffix(('==', '=')) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: removesuffix() argument must be str, not tuple
But if the API was there, I agree this would work, not sure what David is
saying about needing to call twice. On the other hand, this example
demonstrates well how a tuple is potentially confusing. What happens if you
call `'abc=='.removesuffix(('=', '=='))`?