Thank you for reminding Rob. Results are not surprising. Although 10 years ago people preferred C-style, by this time everyone is used to python’s expression.
By this time, after having discussions, I myself, am not a proponent of such change. It was more about possibility of having 2 conditional expressions, not changing it. It was just a part of my more general investigation. My current position is that “deferred evaluation” (if implemented with brief syntax) will cover many (sometimes seemingly unrelated) cases as a side effect of its main intent. Ok, results. Not many respondents. 48 in total. Average 24 per question. (Not sure how that happened.) 1. Which conditional expression is more readable? 83%: var = foo if condition else bar 17%: var = condition ? foo : bar 2. Which conditional expression is more readable? 84%: var = (foo if foo is not None else default2) if condition else (bar if bar is not None else default2) 16%: var = condition ? (foo is not None ? foo : default1) : (bar is not None ? bar: default2) 3. Would you use more conditional expression statements if it was more like in C? 12%: yes 88%: no Comments: 1. They are fine the way they are. 2. They're fine for occasional use, as your second example abundantly shows, nested conditionals are an abomination in the sight of beasts and men. 3. The C syntax is undecipherable gobbledegook to beginners or people coming from other languages without that same syntax. It is the opposite of Python's ideal of "executable pseudocode". The Python syntax is easily understandable to anyone who knows English as it follows English syntax: "What are you doing tonight?" "I'm going to the movies, if I manage to leave work on time, otherwise I'll just stay home.” * Is the english sentence “If I manage to leave work on time, I’m going to the movies, otherwise, I’ll just stay home” incorrect? 4. lol, I would never use that nested conditional expression. I'd definitely break it out into an if-else statement that had the conditional expressions. (I also break out nested list comprehension a into a for loop for readability in the rare cases I have them.) 5. Don't change them now! (this was hashed out 20 years ago!) * It was more about adding an alternative, not changing it. 6. Python conditional expressions are English, or very nearly. C ones, using a question mark which could mean anything, are obscure (unless perhaps you are very very familiar with them). 7. I do not 8. they won't change 9. Python has a syntax for conditional expressions. Learn it, if you want to use Python. No need to create multiple syntaxes for the same thing. * Hello Chris A? :) 10. Conditional expressions are always confusing 11. Syntax highlighting matters and adds to the inherent readability of Python's ansatz. Thank you all for taking your time in these discussions and filling in this quick survey. This has helped me getting answers I was looking for. Hopefully, this wasn’t a waste of time from your perspectives either. —Nothing ever dies, just enters the state of deferred evaluation— Dg > On 5 Aug 2023, at 09:22, Rob Cliffe <rob.cli...@btinternet.com> wrote: > > When can we expect the results of your survey? (I responded to it.) > Best wishes > Rob Cliffe > > On 17/07/2023 21:41, Dom Grigonis wrote: >> Hi everyone, >> >> I am not very keen on long discussions on such matter as I do not think >> there is much to discuss: there is no technical complexity in it and it >> doesn’t really change or introduce anything new. It is only a matter of >> opinion & style/design preferences with respect to logical order and brevity >> of a statement. >> >> So I thought, if anyone can be bothered on such question and instead of >> writing 3-minute e-mail, would take few seconds to answer 3-question poll. >> >> https://q5yitzu62.supersurvey.com <https://q5yitzu62.supersurvey.com/> >> >> Would be interesting to see if my preference is an outlier or not really. >> >> >> Kind regards, >> D. Grigonis >> >> >> >> >> _______________________________________________ >> Python-ideas mailing list -- python-ideas@python.org >> <mailto:python-ideas@python.org> >> To unsubscribe send an email to python-ideas-le...@python.org >> <mailto:python-ideas-le...@python.org> >> https://mail.python.org/mailman3/lists/python-ideas.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/NZVLR56BFMBJXE6GN2GWRXIG6ZVAAWZZ/ >> >> <https://mail.python.org/archives/list/python-ideas@python.org/message/NZVLR56BFMBJXE6GN2GWRXIG6ZVAAWZZ/> >> Code of Conduct: http://python.org/psf/codeofconduct/ >> <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/M46H5G33ESV6XNO7DTQUY6UOXO6XEFZT/ Code of Conduct: http://python.org/psf/codeofconduct/