Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
Feature or enhancement
Allow thecount argument ofstr.replace
to be a keyword to better describe its use.
Pitch
str.replace
takesold
andnew
strings as parameters, and an optionalcount
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 thecount
parameter could also be a keyword, so there's no doubt about its meaning.
Previous discussion
Suggested by@treyhunner athttps://mastodon.social/@treyhunner/110664375381530126