Skip to content

PLW3301 false positive if outer call has multiple arguments and inner call has one argument #18849

@zackw

Description

@zackw

Summary

This is the converse of #16163. In general,

    v1 = max(lower_bound, max(iterable_1)) # erroneous PLW3301
    v2 = min(upper_bound, min(iterable_2)) # erroneous PLW3301

cannot be expressed any other way, but -- even after the change in #16885 -- ruff with PLW3301 active will tell you to change it to

    v1 = max(lower_bound, iterable_1) # now crashes
    v2 = min(upper_bound, iterable_2) # now crashes

which is probably going to throw a TypeError, and even if it doesn't, it won't do the same thing as the original.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions