logoalt Hacker News

nomelyesterday at 11:32 PM4 repliesview on HN

And, there are multiple white space symbols!

<space><space><tab><space>

is different than

<space><tab><space><space>

So you also have to track the actual sequence of counts of white space used for each level, rather than just a simple count.


Replies

rmunnyesterday at 11:43 PM

Or you just forbid mixing spaces and tabs in the same indentation sequence, the way most whitespace-sensitive languages seem to end up doing. Or you make a slightly more reasonable rule: spaces may follow tabs, but no tabs may follow a space. That's at least unambiguous.

show 2 replies
jubilantiyesterday at 11:55 PM

> <space><space><tab><space> is different than <space><tab><space><space>

in my view, both are the same, both `is` (or ===) an IndentationError raise

fc417fc802today at 12:15 AM

It's just a stack containing strings at the end of the day. Really not a big deal.

show 1 reply
TZubiritoday at 12:37 AM

For a 1024 byte implementation (and even way more complex impl.) You would just force one whitespace char, and definitely no mixing.