Skip to content

simplify colorsys.rgb_to_hsv #124879

@Yay295

Description

@Yay295

Feature or enhancement

Proposal:

By inlining some variables, the number of operations performed can be reduced. Example:
with

gc = (maxc-g) / rangec
bc = (maxc-b) / rangec

then

h = bc-gc
h = (maxc-b)/rangec - (maxc-g)/rangec
h = ((maxc-b) - (maxc-g)) / rangec
h = (maxc - b - maxc + g) / rangec
h = (g-b) / rangec

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytype-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions