Code completion not available on object if it is an argument.

Answered

My problem is simple. I have an object from a class that's being passed in as an argument. Code completion is not available to see the methods and things for that class because pycharm doesn't know that the argument is an object nor what object it is. Is there anything that can be done?

2 comments
Comment actions Permalink

UPDATE: this is a shitty fix but it works, just have the default value for the argument (if the argument isn't supplied) that is equal to the the object. That way pycharm has a reference for what the argument is. This wont work for most cases were you may have a different default argument then the object, or the object will do a thing in the __init__ but for my uses it works.

0
Comment actions Permalink

If you use type hints than code completion is available within the method. E.g.:

 

import my_module

def my_method(obj: my_module.my_class):

    pass

 

 

1

Please sign in to leave a comment.