List __getitem__ warning

The following example code produces the IDE warning below:

result = list()
result.append(1)
result.append(result[-1])

Class 'list' does not define '__getitem__', so the '[]' operator cannot be used on its instances

It doesn't produce the warning if I use:

result = []


0

Hello,

 

This is a bug, please vote for https://youtrack.jetbrains.com/issue/PY-50414/Incorrect-warning-Class-list-does-not-define-getitem-so-the-operator-cannot-be-used-on-its-instances in order to increase its priority and be notified about resolution. 

My apologies for the inconvenience. 

0

Thanks Antonina,

I'll have a look at that link.

Cheers Troy

0

请先登录再写评论。