3 ms·
> In Python I have to figure out what the indentation is built from, spaces or tabs, and make sure there's no ambiguity there. The following program throws a T
by jplatte 9y ago
> In Python I have to figure out what the indentation is built from, spaces or tabs, and make sure there's no ambiguity there.
The following program throws a TabError in Python 3:
def demo():
print("1 tab")
print("8 spaces")
It does work in Python 2, but I'm pretty sure the majority of developers have 4 space wide tabs by now, meaning they won't be able to mix tabs and spaces in Python 2 code either.
EDIT: So Hacker News has code blocks, but doesn't strip the indentation that is required to introduce them. So you'll have to lead the 2 leading spaces in each line if you want to try this out for yourself.
- reificator 9y ago> So Hacker News has code blocks, but doesn't strip the indentation that is required to introduce them. So you'll have to lead the 2 leading spaces in each line if you want to try this out for yourself. Your example is good, but the technical issues experienced in posting your example are perfect.