IDE Python

Hannu Kankaanp?? hanzspam at yahoo.com.au
Thu Oct 2 02:54:45 EDT 2003


Irmen de Jong <irmen at -NOSPAM-REMOVETHIS-xs4all.nl> wrote in message news:<3f79f9b0$0$58706$e4fe514c at news.xs4all.nl>...
> But keep in mind that powerful 'intellisense'
> is impossible in such a dynamic language as Python...

I wouldn't say so. Autocomplete just needs to be a bit more
intelligent than in statically typed languages. At first, it
could search all class definitions for method names. Then
at first it could only help you when typing long variable
names since they can be pretty unique across different
types - And completing long names is where autocomplete
is most useful anyway. After you called one or two methods
for a certain type, it could narrow down the
possibilities of what type the variable is,
or possibly nail it down to some specific type right
away. The auto-complete could memoize the types
you use often and have preference for those types. It could
also memoize patterns in variable names and then figure that
if the variable name has "text" or "name" etc. in it, it's
more probably a string object, since that's how the programmer
indicated string-like objects earlier too. And similarly if
you have two variables named 'internal_buffer' at different
parts of your program, they're likely the same type.

Then it could also search code and look where some functions
are actually called. The call site often has more info of
the types being used. Functions in a single module often
work with similar types too, so the auto-complete tool could have
preference to the types used (already deduced) in the current module.

All in all, I believe a very powerful autocomplete tool is possible
in a dynamically typed language. After all, we as humans know what
the types often are and what methods we will want to call for the
parameter objects. An auto-complete-tool can try to archieve
the same (without having to plug into our brains and read our
thoughts, mind you).

What dynamic typing lacks though, is 100% reliability of the type. 
Auto-complete-tool could be correct 95% of time and it wouldn't really
matter if it sometimes did a mistake. But automatic refactoring tools
are something that can't make mistakes, since they often
have to deal with so many renamings. Bicycle Repair Man (Python
refactoring tool) also often says "50% chance" and the like
for variable names that it can't deduce with certanity. Perhaps
there's no cure for that, unless the refactoring tool is 
some super-smart AI.




More information about the Python-list mailing list