pylint-bot / test

0 stars 0 forks source link

Understand list/set/dict comprehension #135

Open pylint-bot opened 9 years ago

pylint-bot commented 9 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?)


We could infer what a list set or a dict comprehension returns when inferred, by using node.ilookup and creating a List / Set or Dict.

This can be useful for detecting bugs as these:

#!python

f = [i for i in [1, 2]]
print(f[0].lala) # int has no attribute lala
[i for i in range(1)][9] # oups index error

etc