In situations like that where it's defined as a literal, most IDEs can offer completions, but define it as the result of some custom computational function that always returns a string (or some other object) and the IDE has no clue what it is.
Our Python Language Server uses iterative full-program analysis to track the types of all the variables in your project while simulating execution of all the code in your project.
You can also use type hints, should work for most IDEs.
Recently, I've only used PyCharm, which is great, but isn't good with completions. I imagine an IDE that can fully analyze a program to determine object types in a duck-typed language must add quite a bit of computational overhead to development, especially for really complex projects. Just guessing though.
3
u/anders987 Jul 20 '18
That depends on which IDE you use. Visual Studio Code knows that it's a string.