3 ms·
Myth: "You cannot safely mix tabs and spaces in Python." In fact, you can mix 8 tabs with spaces in CPython (and do wacky stuff like def f(): <tab><8 spaces>
by veyron 15y ago
Myth: "You cannot safely mix tabs and spaces in Python."
In fact, you can mix 8 tabs with spaces in CPython (and do wacky stuff like
def f():
<tab><8 spaces>x=3
<4 spaces><tab><4 spaces>y=3
<8 spaces><tab>return x+y
- andrewaylett 15y agoYou can, yes, but is it safe? My understanding of the article is that you shouldn't do it, because it's liable to cause confusion -- it's not safe.
- koenigdavidmj 15y agoIn Python 2, you can run tabnanny[1]. In Python 3, I do not believe that unambiguous tab mixing is allowed. 1: http://docs.python.org/library/tabnanny.html http://docs.python.org/library/tabnanny.html