breaking the ; habit

Alan Daniels daniels at
Sun Feb 13 04:44:11 CET 2000

On Sat, 12 Feb 2000 17:11:22 -0500, the infinitely wise osorronophris
osorronophris (deathbed_tech at spoke forth to us, saying...

>I'm a die-hard C++ programmer that recently took up Python for a change of
>scenery and am enjoying it greatly.  The one problem I am having is that I
>can't break myself of the semicolon habit.  I've tried chewing gum but it
>just doesn't seem to work, and I'd like to avoid the patch.  Any ideas?

If you're working with a text editor that has syntax highlighting, and
it lets you customize that highlighting with regular expressions, just
add an extra expression to flag a trailing semi-colon as a warning.

For example, in VIM, I've added these lines to the python.vim file
that controls its highlighting:

    syn match pySyntaxWarning ";\s*$"
    hi link pySyntaxWarning Error

On the off chance that you use VIM also, take a look at:
E-mail me if you have any questions.

Alan Daniels
daniels at
daniels at

More information about the Python-list mailing list