[Tutor] text editor and debugger for python

bhaaluu bhaaluu at gmail.com
Tue Mar 24 17:41:23 CET 2009

On Tue, Mar 24, 2009 at 5:08 AM, Bala subramanian
<bala.biophysics at gmail.com> wrote:
> Friends,
> I do the scripting in Linux. I use vi editor to code. It is not very
> convenient for me. Kindly suggest me a best free text editor ( i can code
> and debug the code simultaneously ) for python based on your experience.
> Thanks
> Bala

Hello Bala,

I use the vim text editor to program in Python. Vim is very similar to vi.
I use the following to make vim easier for programming (save as .vimrc)

" .vimrc
" Created by Jeff Elkner 23 January 2006
" Last modified 2 February 2006
" Turn on syntax highlighting and autoindenting
syntax enable
filetype indent on
" set autoindent width to 4 spaces (see
" http://www.vim.org/tips/tip.php?tip_id=83)
set et
set sw=4
set smarttab
" set line number (added by bhaaluu)
set nu
" Bind <f2> key to running the python interpreter on the currently active
" file.  (courtesy of Steve Howell from email dated 1 Feb 2006).
map <f2> :w\|!python %<cr>

After saving the above file as .vimrc (dot vimrc) in your home directory
(/home/bala/.vimrc <- for example) you can fire up vim and start
programming in Python.

Press the F2 function key to run your Python code.
When the code completes its run, you are returned to vim for more coding.

For debugging, I use print and raw_input().
I use print to watch variables. I use raw_input() to set breakpoints.

Happy Programming!
b h a a l u u at g m a i l dot c o m
Kid on Bus: What are you gonna do today, Napoleon?
Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!

More information about the Tutor mailing list