[Python-mode] how to enable auto-complete in the mode

Skip Montanaro skip at pobox.com
Wed Apr 27 19:45:19 CEST 2005


Okay, we're closing in on me understanding your request.

    Heap> It meant that when I edit python in xemacs. There is CPython mode,
    Heap> how can I edit the xemacs bindings so that it allows auto-complete
    Heap> the class methods?  I meant in IDE like komodo, they will
    Heap> auto-complete the bindings for you.  Is there a mode in xemacs?

What sort of completion are you looking for?  Assume I have this class:

    class SillyClass:
        def __init__(self):
            self.long_attribute_name = 5

        def SillyMethodWithALongName(self):
            print self.long_attribute_name

Somewhere else in another module I instantiate it:

    silly = SillyClass()

Now, I want to call its long method, so I type:

    silly.Silly

then hit the TAB key (or something similar).  Do you expect it to
automatically complete to

    silly.SillyMethodWithALongName

?  Given that Python is such a dynamic language, I can't see how that could
be done reliably.  The only way I can see to implement this easily would be
to coopt Emacs's TAGS facility to replace partial function/method names with
the result of (find-tag-tag).  That puts an extra burden on you to generate
TAGS files, typically from a Makefile.

-- 
Skip Montanaro
skip at pobox.com


More information about the Python-mode mailing list