Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allowstr.replace's 'count' to be a keyword argument #106487

Closed
Labels
3.13bugs and security fixestype-featureA feature request or enhancement
@hugovk

Description

@hugovk

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixestype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp