Skip to content

Files

Latest commit

 

History

History
25 lines (16 loc) · 476 Bytes

unbalanced-dict-unpacking.md

File metadata and controls

25 lines (16 loc) · 476 Bytes

Pattern: Possible unbalanced dict unpacking

Issue: -

Description

Used when there is an unbalanced dict unpacking in assignment or for loop.

Example of incorrect code:

FRUITS = {"apple": 2, "orange": 3, "mellon": 10}

for fruit, price in FRUITS.values():  # [unbalanced-dict-unpacking]
    print(fruit)

Example of correct code:

FRUITS = {"apple": 2, "orange": 3, "mellon": 10}

for fruit, price in FRUITS.items():
    print(fruit)