On Wed, Jul 22, 2020 at 06:14:39AM +0300, Paul Sokolovsky wrote:
On Wed, 22 Jul 2020 09:45:31 +1000 Steven D'Aprano email@example.com wrote:
On Tue, Jul 21, 2020 at 10:07:47PM +0100, Barry wrote:
- Because that not what else mean today. Its elif never looped.
py> for x in [1,2]: ... print("inside loop") ... else: ... print("elif never looped") ... inside loop inside loop elif never looped
This is why I have long-argued that the keyword here should be *then* not else. The semantics are that the loop executes, *then* the following "else" block executes,
But no, loop executes, *or else* the following "else" block executes ;-). That's the logic of founding fathers. After one grasped that logic, one comes to appreciate a weird beauty of it. The verdict remains the same though: "Do Not Use".
I am confused. I don't understand your comment.
Your "But no" suggests to me that you are disagreeing with me. Your comment "loop executes *or else* ..." suggests that you are denying the evidence of the code, and defending the idea that either the loop runs, or the else clause runs, but not both.
You literally say that the loop runs, *or else* (xor) the else block runs. But you say this in response to a demonstration that the loop runs, *and* the else block runs.
So I am stuck in a "does not compute" moment. I cannot see any other interpretation of your comment apart from disagreement:
"No Steven, you are mistaken, never mind that the code you copied and pasted demonstrates that the loop block and the else block *both* run, never mind that anyone can run their own tests to demonstrate that *both* run, that's wrong, either the loop runs *or else* the else block runs but not both."
If there is another interpretion of your comment it is too subtle for me after a long and tiring day. I cannot see any interpretion other than you literally denying the reality of how for...else blocks work.
And I cannot believe that you would do that. Surely I must be misinterpreting you.
Hence, "Does Not Compute".
What am I missing?