Much of what you respond to me indicates that you did not properly read what I have written and did not really understand where I am coming from.
> On 18 Jul 2023, at 04:04, Chris Angelico <ros...@gmail.com> wrote: > > On Tue, 18 Jul 2023 at 10:37, Dom Grigonis <dom.grigo...@gmail.com> wrote: >> As opposed to >> >> if a == 0: >> foo, bar = var1, variable2 >> else: >> foo, bar = default, default2 >> >> >> Again, one is `a == 0`, another is `b == 0`. I didn’t do a good job >> conveying this did I… Will try to be more precise and leave less room for >> misinterpretation. > > Would you really go through and change all your variable names if it > turns out that what you actually need is "a == 0" and "b == 15"? This > sort of alignment is so fragile and unnecessary. Yes, it's nice when > it works out, but it should never be a high priority. > >> foo = foo3 if foo2 == 0 else default >> bar = barbarbar if bar2 == 0 else default2 >> >> # As opposed to >> >> foo = foo2 == 0 ? foo3 : default >> bar = bar2 == 0 ? barbarbar : default2 > > Extremely artificial. You've shown that, if the conditions are the > same lengths but the "if-true" expressions aren't, you can align them > using ?: and can't align them using if-else. It's just as valid to > show: > > foo = "yes" if foo2 else "no" > bar = "yes" if barbarbar else "no" > > Like I said, extremely fragile. > >> I don’t think it is that easy to draw the line here. >> Everything in both of those PEPs can be expressed using current constructs. >> So maybe they are about more compact expressions? > > "Can be expressed"? Well, yes. Python is Turing-complete. So is > Brainf*. Doesn't mean we want to use it though. > > Expressiveness is a spectrum or a scale. You can improve on it without > the older version being impossible to write. In fact, Python really > doesn't NEED all the syntax it has. Have a read of this series of blog > posts: > > https://snarky.ca/tag/syntactic-sugar/ > > (Brett Cannon also did a talk on this at PyCon US 2023; not sure if > that's been made public yet.) There are only a handful of pieces of > syntax that you really can't do without. But you CAN skip having an > "if" statement. No kidding - you can eliminate the if statement by > smart use of the while statement. > https://snarky.ca/unravelling-if-statements/ > > Improvements to expressiveness allow us to write better code, to make > it clearer what the *programmer's intent* is. Sometimes that aligns > with compactness; sometimes it doesn't. > >> Was python made for conciseness or expressiveness? Everything it does can >> already be done in C isn’t it? So I would argue any abstraction is really >> more about conciseness. Expressiveness is more about incorporation of what >> is already there, but not in the abstraction, i.e. extension. But python >> being interpreted language written in another language, I really FAIL to see >> how is all of this NOT about conciseness and modularity? >> > > Expressiveness. It's about how well the source code represents the > programmer's intent. You could write all of your code as a massive > matrix of logic gates, but that wouldn't improve readability. And > since you can implement logic gates with water - see > https://www.youtube.com/watch?v=IxXaizglscw for proof - your program > source code could be an acrylic sheet with a bunch of buckets glued > onto it. > > But none of us want to write code like that, and definitely none of us > want to read code like that. > > ChrisA > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/B5YRPPGSGQTAMM6WOKGULK2SKVR4H7KT/ > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/HUTXYJC66CYJ7QCLZHEQNMYVUZHLVCQV/ Code of Conduct: http://python.org/psf/codeofconduct/