Skip to content

difflib.Differ._fancy_replace performance (re-use ratio) #145131

Description

@dg-pb

Feature or enhancement

Proposal:

Same as I did for get_close_matches in #142939.

There is one more instance of this, where ratio is calculated twice.

if (crqr() > best_ratio
      and cqr() > best_ratio
      and cr() > best_ratio):
    best_i, best_j, best_ratio = i, j, cr()

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions