dict-iter-missing-items / E1141#
Message emitted:
Unpacking a dictionary in iteration without calling .items()
Description:
Emitted when trying to iterate through a dict without calling .items()
Correct code:
data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129}
for city, population in data.items():
print(f"{city} has population {population}.")
Problematic code:
data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129}
for city, population in data: # [dict-iter-missing-items]
print(f"{city} has population {population}.")
Created by the typecheck checker.