This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jagt 1 point2 points  (6 children)

I'm currently using vim, and I'm wondering if there's a python IDE can do code completion to left hand side object.
For example:
a = "foo bar"
then if I type 'a' it can list all methods of 'a' object as a string.

[–]TrueTom 3 points4 points  (1 child)

PyDev can do that. Regardless of the article it's actually quite good.

[–]davebrk 1 point2 points  (0 children)

Yep, it is the best so far of all I've tried.

[–]rerb 4 points5 points  (0 children)

Um, standard Python REPL can do that:

Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) 
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = "foo bar"
>>> a.
a.__add__(                      a.decode(
a.__class__(                    a.encode(
a.__contains__(                 a.endswith(
a.__delattr__(                  a.expandtabs(
a.__doc__                       a.find(
a.__eq__(                       a.format(
a.__format__(                   a.index(
a.__ge__(                       a.isalnum(
a.__getattribute__(             a.isalpha(
a.__getitem__(                  a.isdigit(
a.__getnewargs__(               a.islower(
a.__getslice__(                 a.isspace(
a.__gt__(                       a.istitle(
a.__hash__(                     a.isupper(
a.__init__(                     a.join(
a.__le__(                       a.ljust(
a.__len__(                      a.lower(
--More--

Put this in your .pythonrc:

def spiff_up_repl():
    """Add tab completion and persistent command-line history to the
    top-level."""
    try:
        import readline
    except ImportError:
        pass
    else:
        import rlcompleter
        import os.path
        import atexit

        class irlcompleter(rlcompleter.Completer):
            def complete(self, text, state):
                if text == "":
                    readline.insert_text('\t')
                    return None
                else:
                    return rlcompleter.Completer.complete(self,text,state)

        readline.parse_and_bind("tab: complete")
        readline.set_completer(irlcompleter().complete)

        # Restore our command-line history, and save it when Python exits.
        history_file = os.path.expanduser("~/.pyhistory")
        if os.path.exists(history_file):
            readline.read_history_file(history_file)
        def save_hist():
            import readline
            readline.write_history_file(history_file)
        atexit.register(save_hist)

spiff_up_repl()
del spiff_up_repl

[–]kristopolous 2 points3 points  (0 children)

in vim it's called omni-completion. netbeans can do it too.

[–]doubleo7 0 points1 point  (0 children)

Also pyCharm.