'Intellisense' possible for Python?

Cameron Laird claird at lairds.com
Wed Dec 18 17:44:12 EST 2002


In article <3E00F4F5.11997662 at engcorp.com>,
Peter Hansen  <peter at engcorp.com> wrote:
>Greg Brunet wrote:
>> 
>> Coming from a VB background where the IDE allows you to view &
>> auto-complete all of the properties & methods of an object, it's
>> disappointing not to have it - at least in the IDE's I've looked into so
>> far.  While I get this kind of behavior for modules in PythonWin
>> (automatically) and Boa Constructor (by pressing Ctrl-Space), it doesn't
>> work for variables.  Is this even possible, given that Python doesn't
>> declare it's variable?  Does anyone know of an IDE that supports it?
>
>The problem is not that Python doesn't "declare" its variables, so much
>as that in Python, variables *do not have a type*.  The data/objects to
>which variable names are bound do have type, but those types cannot be
>known reliably until runtime, and in fact could change from one pass
>through a given line of code to the next.
>
>def printit(x):
>    print 'output: %s' % (x,)
>
>printit('test')
>printit(5)
>class A:
>    def __str__(self):
>        return 'an A'
>printit(A())
>
>If you were editing code inside the printit() function, how could
>an IDE know what to display for the methods of an object?  Anything
>can be passed in...
>
>Maybe an IDE could make an educated guess, based on recent code
>patterns, but at the very least this cannot always work, and it
>could be fairly limited in what it can do.... how often do you 
>refer to an object immediately after creating it, versus working
>with an object that was created elsewhere and passed in from outside
>the current context?  Probably rarely...
>
>-Peter

Let me offer what I regard as a more affirmative way to
express this:  "Intellisense" is more valuable for VB
*because* VB embodies so much redundancy.  Yes, certain
solecisms manifest earlier in VB than they do in Python,
and, all things being equal, that would be an advantage
for VB.  All things better not be equal, though; good
style in Python emphasizes concision and abundant unit
testing.  If you're working in Python, and think, "ah,
if only Intellisense were here to autocomplete some 
stuff", that's a clue that there's probably a more
elegant and Pythonic way to express your solution, one
that builds in what Intellisense only guesses.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html



More information about the Python-list mailing list