Skip to content

Feature request: unnecessary-literal-within-deque-call (C409/C418 but for deque) #13515

@Avasam

Description

@Avasam

Today I found the following code:
self.frame_buffer = deque([], self.frame_buffer_size)

Which, to my understanding, should be the same as
self.frame_buffer = deque(maxlen=self.frame_buffer_size)
(but w/o an extra empty literal, be it a list, tuple, set, etc)

Same with x = deque([])/x = deque(()) --> x = deque()

There may be more collection types for which this idea applies.

I think this could be enforced by a linting rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing 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