Auto complete for dynamically created variables

I have created a class which takes in a dictionary which it uses as metadata to create all the variables in the class using setattr.

This lets me very concisely describe variables and auto-magically get range checking, and create GUIs that handle all the setting and getting and all sorts of lovely stuff.

What I lose though is autocompletion because the members are added using setaddr and not explicitly in code.

There should, however, be some way that I can hook into the pycharm autocompletion system and tell it about all the members that are described in the dictionary but I can't find anything like that.

I see a lot about using doc strings to document parameter types...but that's not quite the same thing.


Comment actions Permalink

Could you show a piece of your code that creates these objects dynamically from provided data?

Comment actions Permalink

Could you use type hinting, either through docstrings or Python 3.5 PEP 484?

I haven't tried it to see if it works in the case where you implement the type information dynamically, as you describe.


Please sign in to leave a comment.