On Thu, 3 Mar 2022 at 21:14, Steven D'Aprano firstname.lastname@example.org wrote:
What did I say that made you think I denied the existence of filtered iteration? Was it the post where I pointed out we've been able to do filtered iteration going back to Python 1.x days?
ANYTHING can be done by composing concepts. We don't need anything more advanced than Brainf*. Why do we have better concepts? Because they do a better job of expressing abstract concepts.
To be clear, there are lots of concepts in coding. Not all of them require their own specialised syntax. We don't have specialised syntax for a try...except block inside a loop, we use composition by putting a try...except block inside a for loop.
Composition of statements is not a bug to be fixed.
Indeed, but I'm putting the viewpoint - which a number of other people have also put - that filtered iteration DOES deserve a better way of expressing it.
Nobody said that the idea of filtered looping doesn't make sense. They're only questioning whether it needs its own syntax instead of composing existing syntax.
Yes. And it keeps coming up, so I think you should probably acknowledge the fact that maybe, just maybe, this is more significant than "one newline".
You're thinking FAR FAR too concretely about this. It's not about newlines.
Of course it is. The whole point of the proposal is to move a two line statement into a single line. Earlier in this thread, I pointed out that this proposal adds no new functionality to Python. It doesn't allow us to do anything we can't already do, or even make it easier to do it.
Literally all it saves is a newline and an indent.
No, it is not. It is expressing the concept of filtered iteration. Do you, or don't you, accept that that is a concept? One moment you say that it is a concept but you think it shouldn't get dedicated syntax, then the next, you imply that it isn't even a concept, and all we're doing is reformatting code. That is simply not the case.
It's about expressing programmer concepts.
Right. And composing a for-loop with a if statement expresses that concept perfectly. As does filter().
No, it doesn't.
Fresh strawberries are great. Mushroom sauce is great. But strawberries with mushroom sauce is ... not.
You DO know that you just made several people think "hmm, maybe I should try strawberries with mushroom sauce", right?
I love how utterly unapologetic you are. And I really hope that someone actually tries it, and reports back to the list. Who knows? Maybe we'll start a new fad!