3 ms·
> "You cannot safely mix tabs and spaces in Python." You can mix spaces and tabs all you want as long as you are consistent. This is fine. if 0: <tab
by onedognight 15y ago
> "You cannot safely mix tabs and spaces in Python."
You can mix spaces and tabs all you want as long as you are consistent. This is fine.
if 0:
<tab><sp><tab><sp>1
<tab><sp><tab><sp>2
This is not, for any number of spaces.
if 0:
<tab>1
<sp><sp><sp><sp><sp><sp><sp><sp>2
- falcolas 15y agoTechnically, the parser converts one tab to 8 spaces (at least in the versions of python I'm familiar with), so your second statement is not quite true. def foo(): <tab>print 'a' <sp><sp><sp><sp><sp><sp><sp><sp>print 'b' compiles and runs properly in python 2.6.