On Wed, Aug 22, 2018 at 6:24 AM, Abe Dillon <abedil...@gmail.com> wrote: > [Chris Angelico] >> >> That right there is unacceptable. You should not have to know the >> destination to understand what something fundamentally is. > > > You don't *have* to know what the parameter "key" is to know that > (value[card.suit] ... with card) is a function. You can identify that it's a > function just by reading the full expression. However, if you don't know > what "key" is, then it'll cause far more confusion than the late declaration > of the function's parameters. > > [Chris Angelico] >> >> You can't redefine language syntax based on the function being called. > > > That's not at all what I suggested. You were walking through my example from > the reader's perspective. I was explaining how the reader will often have > plenty of context about what they're reading before they get to the > signature declaration. Whether it be because they know what the "key" > parameter means or because they know "card" is undeclared or both. I never > claimed the language syntax should be based on the function being called. > > func = value[card.suit] if card not in wilds else wild_value with card > > Works independent of the function being called. It's just not a common use > case because it obviates the expressiveness of anonymous functions. You > might as well use a "def" statement.
Python's parser is *deliberately* incapable of backtracking this far in its definition of syntax. So if you want to have something where the first long slab of it is entirely acceptable as an expression, right up until you get to the "with" at the end, it's not going to work. You then said that it was the parameter "key" that told you that this would be a function, which is also unacceptable in Python syntax. So how do you intend to do this? And you still haven't done anything to show that this is actually better than "lambda card:" at the beginning. I'm done. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/