Komodo Python auto complete: type inference by variable metadata?

后端 未结 2 405
无人及你
无人及你 2020-12-10 07:30

I\'m using Komodo Edit for Python development, and I want to get the best out of the auto complete.

If I do this:

a = A()
a.

I can

2条回答
  •  心在旅途
    2020-12-10 08:14

    I don't think that you'll have much luck with this. The problem is that it's really quite difficult to statically infer the type of variables in Python except in the simplest of cases. Often the type isn't known until run-time and so auto completion isn't possible.

    The IDE does some static analysis to work out the obvious and best guesses, but I'll bet it isn't even trying for elements in a container. Although we can work out that b is of type A even small variations to your code can make it unknowable, especially as it's in a mutable container.

    Incidentally I've tried this on the full Komodo IDE and it's no better. I hear that Wing IDE has excellent code completion, but I wouldn't be sure it could do any better either.

提交回复
热议问题