I've just hit my first-ever logic bug in a Python program that is directly attributable to tabs-vs-spaces.
I had code that looked like:
def tasty():
spam = some_complex_code_resulting_in_True
eggs = some_complex_code_resulting_in_False
if eggs:
print 'yum, eggs!'
if spam:
print 'mmm, spam!'
I was observing that I was never seeing "mmm, spam!" when I really ought to have been. That the code was also a Django site - which I have a rather unhappy relationship with to start with - meant that I was looking all over the damn place to try to figure what was going on.
Of course the real problem was that I was coding on a remote system in vim and I didn't realise that I'd not yet configured it to use "expandtabs", though the tab stop was set to 4 spaces. So the indentation of the "if spam" block was actually tabbed in, thus forming part of the "if eggs" block.
Questions: anyone know why "-tt" is not turned on by default? Is there any way to turn it on for something like mod_python?
Update: hey, look, the .vimrc does have expandtabs set on... it's just not working for some reason. Hrm.