Pycharm autofill suggestions for dynamically built objects
Answered
Hello
I'm building objects dynamically using settattr() from a known set of allowed attribute names. I would like PyCharm to suggest me those attribute names. Is there a way to achieve that?
I tried using __slots__ in my classes, but PyCharm didn't use them for suggestions.
Please sign in to leave a comment.
Hi Michal! There's a similar ticket in our tracker: PY-20062 feel free to vote for it. Meanwhile only way to achieve this right now I can think of is to create a stub file (.pyi) for your script and specify all possible attributes there. Something like this:
Works like a charm! Exactly what I needed. Thanks