5 ms·
white space as a delimiter is why i never use python.
by katbyte 3y ago
white space as a delimiter is why i never use python.
- naikrovek 3y ago> white space as a delimiter is why i never use python. Whitespace is a delimiter in (almost?) all languages humans use. Whitespace determining which scope you’re in is one of the many problems of making whitespace significant, which might be what you meant.
- tomoyoirl 3y ago“The thing that controls scope is the count of certain nonprinting characters, which happen to come in multiple widths” is reasonably insane, yes
- eru 3y agoWhich non-printing characters are you talking about? Whitespace characters are very much printable. Yes, I agree that Python should just forbid tabs. As a second best, you can tell your linter (and/or formatter) to forbid tabs (and any weird unicode whitespace). That's basically the equivalent of compiling your C with -Wall.
- takeda 3y agoThis was an issue in Python 2, where for some dumb reason it allowed mixing tabs and spaces and equated tab to 8 spaces (I think). Python 3 doesn't have that issue.
- capitainenemo 3y agoOf course, if one was coding an exploit, one could still use python2. It is still commonly available due to a long tail of legacy scripts and in some cases (like a script I use routinely but didn't write) the difficulty of porting it to python3 (I've asked over a dozen pythonistas over the years, they kept running into same problems)
- ratmice 3y agoRegarding your almost query. There was a debate over Ogham space mark in unicode. It is considered whitespace though, with the rationale that it is sometimes visible, but sometimes invisible. Depending upon whether the text has a stem-line. That doesn't make the set of non-whitespace delimited languages empty. Perhaps there is one with an always-visible delimiter that didn't get the whitespace justification, but does at least give one human language delimited by a printable character (which happens to be whitespace).
- eru 3y ago> That doesn't make the set of non-whitespace delimited languages empty. Well, there's also the opposite: Goldman Sachs's Slang allows space as part of identifiers.
- skissane 3y ago> Well, there's also the opposite: Goldman Sachs's Slang allows space as part of identifiers. Many SQL implementations permit whitespace in identifiers, but then you need to use quoted identifiers.
- eru 3y agoThat's reasonably sane of SQL. In Slang, you don't need to quote. (The syntax is still unambiguous. In principle, eg Python could do something similar, because they don't have any existing syntax where you just put two identifiers next to each other with only a space in between. But C could not, because variable declaration is just two identifiers, one for the type and one for the variable name, next to each other with a space in between.)
- skissane 3y agoIn Slang, are “x y” with different number of spaces in the middle different identifiers or different spellings of the same identifier? SQL standard says different identifiers > eg Python could do something similar, because they don't have any existing syntax where you just put two identifiers next to each other with only a space in between The interaction with keywords would cause some issues. For example, right now, “if” is not a valid identifier (keyword), but “if_” and “_if” are. However, with this proposal “x y” could be a valid identifier, but “x if” would introduce ambiguity > But C could not, because variable declaration is just two identifiers, one for the type and one for the variable name, next to each other with a space in between This is one aspect of C syntax I have never liked. I always wish it had been Pascal-style `x:int;` instead of `int x;`
- WirelessGigabit 3y agoHuman language is also way more ambiguous. One of the reasons I love coding is a massively reduced vocabulary and a way more strict grammer.
- throwaway2037 3y ago[flagged]