Question about indentation and bugs

Skip Montanaro skip at pobox.com
Fri Aug 24 11:11:31 EDT 2001


    Greg> There is one thing to keep in mind, though: NEVER MIX TABS AND
    Greg> SPACES IN INDENTATION.  A given file should be indented using
    Greg> either tabs only or spaces only.

Good point.  For Emacs's python-mode at least, this is automatic.  It turns
off indent-tabs-mode if the indent offset doesn't equal one tab width and
will never turn it on.  I suspect other popular editors have commands to
disable TAB insertion.  Also, after getting (mildly) beat up by Tim Peters a
few times in python-dev about mixed spaces & tabs in my posts to that list,
I added a simple mail-send-hook as well:

    (defun untab-buffer ()
      (untabify (point-min) (point-max)))

    (add-hook 'mail-send-hook 'untab-buffer)

People who use Emacs to send mail and occasionally post code might try
that.  Another option would be to disable indent-tabs-mode in your mail send
buffers.

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list