by sametmax · 8y ago · 0 comments
- pattern matching
- inline exception catching
- path inclusion in the built in
- more functional tooling
- lazy keywors
That were BDFL-blocked, will go back to be debated in the mailing list in the next months.
And if yes, will the community stands by its root or create a new era ?
The consequences of which we will only really see in 10 years.
Guido as done an incredible job at being the boogie man, keeping the language simple and readable. It's a hard job.
Can we pull it off ?
There's so many cases (arguably including the problem this PEP was designed to solve!) where having a real inline closure is just far more readable than having to arbitrarily break every single thing that happens to need 2+ expressions out into named blocks out of sequence.
Other things in Python are either simply a result of the language's age and history, or have real technical pros and cons, but that one irks me because it's an artificial limitation chosen for no reason except aesthetics.
God please NO!
I would KILL not to make that happen. So many devs abuse those in every language that has that. Even lambas get sometimes abused in Python (and I have a few examples in our codebase unfortunately). Expanding lambdas' scope is the LAST thing I want in Python, this would just lead to worst codebases, with nearly 0 benefit.
If you want to do something that needs 2 expressions, just create a goddamn function and name it for god's sake.
Sorry but I had to say it, I think the lambda limitations is one of my favorite feature in Python.
It could and could also not be useful to give names to all the subexpressions in the following
w = a(b(c(x,y),z))
You could impose a limitation on how many function can be in a single expression, forcing you to give names. That's analogous to your favorite feature, no?
With PEP 572 it wasn't like that. There wasn't a Pythonic way to do list comprehensions which used the same expensive to evaluate expression two times in it and it was I think the only glaring syntax weakness in comparison to languages which have a way to do that (like WHERE keyword in Haskell).
</Sarcasm>
But seriously, I think there's no one way to do things anymore especially if it holds up productivity and effectiveness. Let the pattern matching begin.
[foo(y, y) for x in xs for y in [f(x)]]
Is this Pythonic? Perhaps not, but mainly because multiline list comprehensions are frowned on in general. I think people tend to get too dogmatic about that.Python does that with tuples:
a, b = b, a
But it just stops there. To be fair, I don't know how much power it would gain by going further either. Never made that question.It's why it's hard.