[New-bugs-announce] [issue44521] str.removeprefix(): add strict: bool

Марк Коренберг report at bugs.python.org
Mon Jun 28 05:58:50 EDT 2021


New submission from Марк Коренберг <socketpair at gmail.com>:

#39939 introduced .removeprefix for several classes. I propose adding kwargs-only parameter `, *, strict: bool = False`. It should raise some exception (I'm unuse what exactly) if the string DOES NOT start from specified prefix. False by default only for compatibility purposes. Personally I think it should be True, but I understand why it's impossible to change API.

The same about `removesuffix()`.

----------
components: Interpreter Core, Library (Lib)
messages: 396627
nosy: socketpair
priority: normal
severity: normal
status: open
title: str.removeprefix(): add strict: bool
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44521>
_______________________________________


More information about the New-bugs-announce mailing list