IDLE uses the same model - completions come from inspecting live objects in
the shell.
This applies to the editor as well, with IIRC one hack for modules:
when completing "module.name", if there is no "module" in the shell's
globals, fall back to sys.modules["module"] if any.
The result is quite useful completions in the editor after you press F5
(Run) at least once.
No need to Run every time you hit enter.  You just get a bit stale
completions.  User is free to Run frequently, if it's safe and quick.

The main weakness is that locals and self. don't get good completions.
Knowing how it works, one can cheat: execute "self = MyClass()" or "x = {}"
in the shell => get good completions for self., x. in the editor
But I rarely did that in IDLE, I found Alt+/ to work very well for locals &
methods.
(like in Emacs, it cycles among identifiers appearing in same file.
http://hg.python.org/cpython/file/tip/Lib/idlelib/AutoExpand.py)

On Wed, May 30, 2012 at 4:55 PM, Bob Farrell <[email protected]
> wrote:

> Hi Sam,
>
> Unfortunately the reasons that bpython works so well for you require
> the code to be running all the time, just as in the standard python
> interpreter.
>
> Simply, here's what happens:
>
> You type in a line of code, it's executed, the variables that you
> created in this line of code then become available to the running
> python interpreter. This allows bpython to inspect these objects and
> provide the auto-complete etc. that you wanted.
>
> So there is no way to have this "Run" button that you want - the code
> has to run every time you hit enter, otherwise there will be nothing
> to inspect.
>
> Hope this explains, sorry to disappoint you. :)
>
> On 30 May 2012 14:22, Sam Walsh <[email protected]> wrote:
> > Okay so I absolutely love bpython and its autocomplete and colorscheme..
> >
> > I really want to be able to use it as a text editor with the same
> > functionality and then have a run button, much like in IDLE where you
> have
> > the interpreter in one window and then the text editor in another
> window..
> >
> > is there any way to do this with bpython, I understand that there are
> > alternative text editors but I just love the way bpython autocmpletes and
> > would love the same in a text variety..
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "bpython" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/bpython/-/gSnW9_YEjf0J.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/bpython?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "bpython" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/bpython?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bpython" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/bpython?hl=en.

Reply via email to