Intelisence (and type inference)

Trent Mick trentm at ActiveState.com
Tue Aug 31 11:43:49 EDT 2004


[Ville Vainio wrote]
> Yes, it's non-trivial, but why is it so hard? I mean, what's the
> killer problem about type inference? I'm not talking about Starkiller
> level type inference (which has to be just right, because the code is
> actually executed) but the kind that would support IDEs for developers
> that use python in a reasonably standard way:
> 
> - Modules are imported from standard places

Handling imports (and "from foo import *") and all variable assignments
and customized sys.path's and all scoping rules and perhaps some basic
flow analysis:

    if foo == 1:
        return <a list>
    else:
        return <a dict>

Basically it just adds up. The real problem is doing this efficiently
for large libraries and for changing documents as the user types in the
IDE.

> - Ambiguous methods are annotated somehow (e.g decorators ;-).

There is no agreement in the community on how to do that. Failing that,
IDE authors are left with using one of the many suggestions out there
(most involve marking up docstrings in certain ways) or coming up with
their own.


> In cases where a name can be bound to instances of multiple different
> classes, suggest all the methods for completion:

Yup, some of that is done.


It is not impossible, but it _is_ hard. :)


Trent

-- 
Trent Mick
TrentM at ActiveState.com



More information about the Python-list mailing list