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 = []


2 comments
Comment actions Permalink

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
Comment actions Permalink

Thanks Antonina,

I'll have a look at that link.

Cheers Troy

0

Please sign in to leave a comment.