Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Using the collecting variable of iterable unpacking causes "used before definition" error #461

Description

microsoft/vscode-python#3543

a, *b, c = range(5)
print(b)

b ends up being reported as used before definition.

Activity

  1. jakebailey commented on Dec 6, 2018

    @jakebailey
    Member

    My guess (without looking too hard) is that we aren't handling this style of unpack properly (see #412, #403), and we're considering it to be a use like it's a mul or a args/kwargs unpack.

  2. md2perpe commented on Dec 13, 2018

    @md2perpe

    I got the same error in a loop construction like

    for first, *rest in data:
        use(first, rest)

    Here, rest gets reported as used before definition on the use line.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions