3 ms·
PyCharm has its own engine and while not perfect, it's fairly good.
by aldanor 5y ago
PyCharm has its own engine and while not perfect, it's fairly good.
- quietbritishjim 5y agoAnd when it fails to infer the type of something you can add `assert isinstance(foo, T)`, and PyCharm will make use of that.
- ramraj07 5y agoThis will throw an error in runtime for bad types, which might or might not be your intention (unless of course you build the package, which only makes it all the more harder to debug if this is where your program fails at this step). So, just don’t use assert outside of tests?
- quietbritishjim 5y agoFor sure, adding that line of code will affect the runtime as well as type hinting in the IDE. Certainly don't use it unless you're sure that the asserted condition is actually always true (or not sure and want to know if it isn't!).
- willvarfar 5y agoI’m not a huge fan of pycharm’s inference and autocomplete. It’s not that it’s bad, I was really just that I was hoping for more. There is so much that could be done eg IDEs could enable proper exhaustive signature checks when running code in debuggers. Pypy could probably do some really good cheap checks in debug mode too. And if not checking while debugging, they could at least highlight failed hints in the call stack when the debugger stops. A long long time ago before MyPy I made a runtime checker called Obiwan. I always preferred its syntax to MyPy, eg [int] instead of list[int]. I then got into playing with SSA within functions and that really helped type checking. So there’s loads more I think could be done to do what typescript did for JavaScript but to python.
- MichaelMoser123 5y agoare you using the free community edition of pycharm, or do you need the paid one for that?
- aldanor 5y agoI'm using CE, don't think you need the paid one for that