
On Fri, Apr 17, 2020 at 11:21:39AM -0700, Andrew Barnert wrote:
On Apr 17, 2020, at 01:58, Steven D'Aprano <steve@pearwood.info> wrote: [...] After saving this draft, closing the email, then reopening it, I read the proposed dict the same way. So I don't think it was just a momentary glitch.
I honestly think, as you suggested at the end, that this may be just you.
You may be right. It might also be a combination of being late at night, unfamiliarity, and short identifiers. Using more meaningful identifiers is less difficult to read: {:ignorecase, 'dunder': True, :reverse} And I appreciate your anecdote about the C struct syntax. [...]
I suspect it may be because we read left-to-right in English and Python, so having the implicit blank come first is mentally like running into a pothole at high speed :-)
What examples can you think of—in English, Python, other popular languages, math notation, whatever—where there’s an infix-operator-like thing and the right token is elided and inferred implicitly? I’m sure there are some, but nothing comes to mind immediately.
Good question. Nothing comes directly to my mind either.
Meanwhile, I can think of lots of examples of the opposite, the token on the left being elided and inferred. You can read -2 and infer 2 less than 0, but not 2- to infer 0 less than 2.
For the record, that's not how negative numbers are taught in Australia. (At least not in my state.) Negative numbers are first taught as signed numbers, on a number line, so that -2 is read as the number two steps to the left rather than two steps to the right of zero. Turning that into subtraction comes later. I think that the consequence of this is that most people (at least most maths students) think of -2 as an entity in its own right, rather than "0 - 2". This is ... good and bad. It may also help to explain why so many people expect -2**2 to be +4 rather than -4 ("but you are squaring -2, right?"). But I digress. [...]
There’s no problem for the parser. Make a trivial change to the grammar to add a `":" identifier` alternative to dict display items, and nothing becomes ambiguous.
Except to the human reader, which is the only ambiguity that *really* matter when you get down to it.
Why do you do this? You snipped out the very next sentence about human readers, just to take this out of context so you can imply that human readers weren’t taken into account just so you can disagree with not taking human readers into account.
Andrew, please calm down and try giving me the benefit of the doubt that I am discussing this in good faith, not maliciously trying to manipulate people. I snipped your next sentence: "And I don’t think it would be confusing to a human reader." because my initial response was to answer it sardonically: "What am I, a teapot?" and I didn't think it would be constructive, so I took it out. Without a response, I didn't think I needed to leave the quote in. Apologies if I was overzealous in snipping relevant text, but no harm was intended. You then went on to make a comment: "It can’t possibly be a set, because colons are what make a dict display not a set display, and there are colons." and I snipped that without comment because I thought your observation was: 1. correct; 2. *obviously* correct, so it didn't need agreement; 3. *trivially* correct, so it didn't need repeating for emphasis; 4. and irrelevant to the point I was making. "Confusion with sets" is not the only possible misreading of the proposed syntax.
And you don’t even really believe this.
Don't I? I was thinking of Harold Abelson's famous quote: “Programs must be written for people to read, and only incidentally for machines to execute.” Perhaps he didn't really believe that either. [...]
There are already enough issues to discuss that fabricating issues that aren’t there just to be contrary to them really isn’t necessary.
Yes indeed. Fortunately, I'm not doing that. Please stop claiming that I am fabricating issues. Please stop straw-manning me. Please stop telling me I don't really believe things without strong evidence. Please stop accusing me of playing dumb over "obvious" analogies. Please stop accusing me of being deliberately obtuse. Please stop treating me as someone intentionally trying to manipulate the discussion in a stupidly obvious way. Please stop treating me as dishonest and a liar. If I say I don't understand an analogy, it's because I don't. Do you really think I'm the kind of guy who wants be seen as "too dumb to get the obvious" as some sort of ploy? If I don't get it, either I *am* that dumb, or it's not so obvious. -- Steven