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

Bisect docs define a function that uses a list as a default argument #145269

Closed
Labels
docsDocumentation in the Doc dir
@ngoldbaum

Description

@ngoldbaum

Documentation

The docs forbisect.bisect use a kind of funky pattern with a list as a default argument:

https://docs.python.org/3/library/bisect.html#examples

Image

Using a list as a default argument is a really common pattern beginners think will be helpful but usually isn't due to the way default arguments are bound to the class object instead of instances. It's also distracting for more advanced readers who are trained to spot this pattern in code reviews.

IMO this example would be clearer ifgrade accepted no arguments besidesscore and the defaults were inlined.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp