# Feature or enhancement Allow the *count* argument of `str.replace` to be a keyword to better describe its use. # Pitch `str.replace` takes `old` and `new` strings as parameters, and an optional `count` parameter: https://docs.python.org/3/library/stdtypes.html#str.replace However, `count` cannot be a keyword argument: ```pycon >>> "aaa".replace("a", "b", 2) 'bba' >>> "aaa".replace("a", "b", count=2) TypeError: str.replace() takes no keyword arguments ``` It would be more explicit if the `count` parameter could also be a keyword, so there's no doubt about its meaning. # Previous discussion <!-- New features to Python should first be discussed elsewhere before creating issues on GitHub, for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org, or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). Use this space to post links to the places where you have already discussed this feature proposal: --> Suggested by @treyhunner at https://mastodon.social/@treyhunner/110664375381530126 <!-- You can freely edit this text. Remove any lines you believe are unnecessary. --> <!-- gh-linked-prs --> ### Linked PRs * gh-106488 <!-- /gh-linked-prs -->
Feature or enhancement
Allow the count argument of
str.replaceto be a keyword to better describe its use.Pitch
str.replacetakesoldandnewstrings as parameters, and an optionalcountparameter:https://docs.python.org/3/library/stdtypes.html#str.replace
However,
countcannot be a keyword argument:It would be more explicit if the
countparameter could also be a keyword, so there's no doubt about its meaning.Previous discussion
Suggested by @treyhunner at https://mastodon.social/@treyhunner/110664375381530126
Linked PRs
str.replaceto be a keyword #106488