I have recently been learning python and I was trying out some things in Pycharm when I noticed the following warning caused by this piece of code:
Class 'Iterable' does not define '_getitem_', so the operator '[]' cannot be used on its instances.
def test_list(var):
"""
Parameters
----------
var : list
Returns
-------
int
"""
return var[0]
I noticed that replacing 'list' by 'list[int]' in the code gets rid of the warning but using 'list of int' doesn't (which if I understand the numpydoc guide correctly is the proper way to do things). So what am I doing wrong exactly?