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

Martin Christensen knightsofspamalot-factotum at gvdnet.dk
Thu Jul 15 16:58:10 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Mark" == Mark 'Kamikaze' Hughes <kamikaze at kuoi.asui.uidaho.edu> writes:
Mark> Jacek Generowicz <jacek.generowicz at cern.ch> wrote on 15 Jul 2004
Mark> 09:18:09 +0200:
>> Mark 'Kamikaze' Hughes <kamikaze at kuoi.asui.uidaho.edu> writes:
>>> Simple way: Select the block of code you want to execute with V
>>> and motion keys, then !python^M
>> This looks like it sends each code snippet to a new interpreter
Mark>   It sends the entire selected block to a new interpreter, yes.
Mark> Not each line to a different interpreter, if that's what you're
Mark> trying to say.

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.

With Emacs' Python mode, you can run a so-called inferior Python
process, which is just to say that you have an interpreter running in
Emacs. You can then keep sending code to this same interpreter. In my
experience, this is immensely practical. When writing a class, for
instance, you can create an instance and do all the necessary set-up,
and without needing to give thought to repeating said set-up, you can
alter method definitions etc. on-the-fly. I get the impression that
with the mentioned approach in vi, you're still stuck with the full
write-run-debug cycle, whereas the 'inferior Python process' approach
takes a lot of the tediousness out of the run part of the cycle. The
same is true for all the other languages with an interactive
interpreter that I've tried. When I've not had Emacs at hand for
hacking Python, this is what I've missed most of all.

I should be greatly surprised if it weren't possible to do something
similar in at least Vim.

Martin

- -- 
Homepage:       http://www.cs.auc.dk/~factotum/
GPG public key: http://www.cs.auc.dk/~factotum/gpgkey.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using Mailcrypt+GnuPG <http://www.gnupg.org>

iEYEARECAAYFAkD27+EACgkQYu1fMmOQldUQGwCdFhwfQOPJKB7hg/ZgdvQjO34A
j5cAn2ICfAgyzzQ1r0v/fFb1x0StaJTp
=ESjc
-----END PGP SIGNATURE-----



More information about the Python-list mailing list