MITx Week 3.5: Textbook and Syntax

MITx and the Python DUDE .: I have worked my way through all lectures and exercises and problem sets released to date. MITx will release coursework for Week 4 on February 7th.

I picked up a copy of the (optional) course textbook: Introduction to Computation and Programming Using Python.

I am writing my Python code using the Neovim text editor and I added the Syntastic syntax checking plugin. It provides a framework for managing syntax files installed separately by the user for various programming languages.

Install and configure

1. Install syntastic plugin using Vundle. Edit Neovim's init.vim ...

Plugin 'vim-syntastic/syntastic'

... and add some recommended defaults for beginners ...

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

2. Install the pylint package (available in Ubuntu) for checking Python syntax ...

$ sudo apt install pylint pylint3

3. Syntastic defaults to using pylint for Python 2 syntax. I am using Python 3 for MITx coursework so I once again modify init.vim ...

let g:syntastic_python_pylint_exe = 'python3 -m pylint3'


More • pythonprogrammingmooc