Interactive Python programming in ... vi [was: Tab wars revisited]

Jacek Generowicz jacek.generowicz at cern.ch
Mon Jul 19 02:56:19 EDT 2004


finite.automaton at gmail.com (Lonnie Princehouse) writes:

> > I think what he was trying to say is this: for each time you send a
> > code snippet to the interpreter, a new interpreter is started, and
> > afterwards you won't have the same interpreter and its state to play
> > with.
> > 
> 
> If you use :!python, then of course you're starting a new python
> session each time, because it's just running the interpreter via
> system()...
> 
> BUT if you use :python, it will keep a persistent embedded interpreter
> sitting around.  Try it:
> 
> :python foo=5
> :python print foo

OK, so this could be one way of emulating the REPL (but I hope that
there might be a more convenient way).

> Reading the help file on :python is highly recommended!

I don't doubt that for one second ... but how do you do it?

[ ... time passes ... ]

OK, I've tried it again, and discovered that you can scroll beyond the
bottom of the screen ... and then some actual information
appears. Phew, what a relief! (On my previous attempt, I thought that
that the |python-commands| &co next to the 5 numbered titles were
links of some sort, and everything I tried resulted in frustration.)

So, am I right in thinking that it's just a single chunk of text, with
some colouring ... which one is supposed to read by scrolling up and
down, or is there more to it (it _looks_ as if there is ...) ?

I guess I really should find the time to go through this with an
interested vim user.

> *only works from inside the embedded interpreter

Hmm, that makes me slightly nervous ... do you get to see some
vi-specefic inerpreter state ... with which you might clash ?



More information about the Python-list mailing list