Reputation: 77
How can I autocomplete the inner element of a list in pycharm and only the inner element ? Not a mixure of methods of the list and the inner element but only the inner element's methods ?
example:
a = list()
a.append(1)
a[0].___ (I want this to only show methods for integers and not both of integer and list)
Upvotes: 1
Views: 62
Reputation: 1123930
You you are using Python 3.6 or newer you should be able to use variable annotations:
from typing import List
a: List[int] = []
This tells PyCharm that a
is a list containing only integer objects.
Caveat: I don't know if the current PyCharm 2016.3 release actually supports PEP 526; the Early Access Programme release 2016.3 certainly included support but I don't follow the release cycle.
Upvotes: 1