Skip to content

"Incompatible types in assignment" when using _ as throwaway variable #2982

@vors

Description

@vors

Should _ get a special treatment?

Repro

import os

for _ in range(3): # throw-away _
    root, _ = os.path.split("C:\\123") # throw-away _

Expected

No errors

Actual

foo.py:4: error: Incompatible types in assignment (expression has type "str", variable has type "int")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions