Python: Can autocomplete be used for the elements in a list?

Viewed 2000

Python has type hints in function arguments and function return types. Is there something similar for elements of a class? I would like to be able to use autocomplete in something like the following example:

class MyClass:
    def hello(self):
        print("Hello")

mylist = []
mylist.append(MyClass())

for i in mylist:
    i.hello() # No autocomplete here

I understand this depends on the IDE but my question is about some language feature like the code hints mentioned above. Something like mylist = [] : MyClass or similar

1 Answers
Related