Code completion - yet another question Follow
Hi there,
Lets assume we have:
Is there a way to communicate PyCharm the type of the list items, so that I can take advantage of code completion?
I know I can use the following:
However, I would prefer code completion without using isinstance or list iteration as with the above example.
Please advice,
Sebi
Lets assume we have:
class A: def __init__(self): self.var = 1 l = [] l.append(A()) l.append(A()) l[0].var += 1 # no type hint
Is there a way to communicate PyCharm the type of the list items, so that I can take advantage of code completion?
I know I can use the following:
for obj in l: assert isinstance(obj, A) print obj.var # type hint works
However, I would prefer code completion without using isinstance or list iteration as with the above example.
Please advice,
Sebi
Please sign in to leave a comment.
Thanks!