Reputation: 451
I want the IDE (pycharm) to know the type of an varliable
class phone:
def __init__(self,):
self.device = None
def connect(self,):
self.device = samsung_object()
Now the IDE don't know the functions/vars used for device. I want that in init time it will be a samsung object type.
Upvotes: 0
Views: 54
Reputation: 1212
Converting comments into code for you :)
This will works and PyCharm knows the type too..
class Samsung:
def foo(self): pass
class Phone:
def __init__(self,):
self.device = Samsung()
def connect(self,):
self.device.foo() # pycharm suggest foo
Upvotes: 2