Skip to content

False positive for F841 Unused variable when using assignment expressions #843

@jcarlosroldan

Description

@jcarlosroldan

This example from the PEP 572 incorrectly reports the total variable as unused:

def cumulative_sum(values):
    total = 0
    return [total := total + v for v in values]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions