r/ProgrammerHumor • • Jul 20 '18

Every Time

Post image
52.2k Upvotes

749 comments sorted by

View all comments

Show parent comments

3

u/anders987 Jul 20 '18

That depends on which IDE you use. Visual Studio Code knows that it's a string.

1

u/mpa92643 Jul 20 '18

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.

1

u/anders987 Jul 20 '18

Some IDEs still know what it is. Works pretty well.

You can read more about it here: https://blogs.msdn.microsoft.com/pythonengineering/2018/07/18/introducing-the-python-language-server/

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.

1

u/mpa92643 Jul 20 '18

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.