Answer the question
In order to leave comments, you need to log in
How to do Type Hinting of classes in PyCharm?
I didn’t figure out how to type-hint in PyCharm (python2) for a function that takes a class or subclasses of this class as an argument. Class instances are hinted great, but how do you hint the classes themselves?
Tried doing it like this:
class Base(object):
field = 0
class Sub1(Base):
field1 = 1
class Sub2(Base):
field2 = 2
class NotSubclass(object):
field3 = 3
def some_func(SomeClass):
# type: (T <= Base) -> None
print SomeClass # если тут сделать "SomeClass." (поставить точку),
# то выпадающее меню после точки не предлагает список атрибутов нужных классов
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question