Allow the count argument of str.replace to be a keyword to better describe its use.
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:
>>> "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.
Suggested by @treyhunner at https://mastodon.social/@treyhunner/110664375381530126
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword (
Implemented in PR #106488 for Python 3.13, due October 2024.
https://devguide.python.org/versions/
Activity
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword (
hugovk commented on Jul 10, 2023
Implemented in PR #106488 for Python 3.13, due October 2024.
https://devguide.python.org/versions/