On a python developers' mailing list for the core developers, Python Committers, Benevolent Dictator for Life Guido van Rossum has announced that he is stepping down effective immediately and with out appointing a successor.
Now that PEP 572 is done, I don't ever want to have to fight so hard for a
PEP and find that so many people despise my decisions.I would like to remove myself entirely from the decision process. I'll
still be there for a while as an ordinary core dev, and I'll still be
available to mentor people -- possibly more available. But I'm basically
giving myself a permanent vacation from being BDFL, and you all will be on
your own.After all that's eventually going to happen regardless -- there's still
that bus lurking around the corner, and I'm not getting younger... (I'll
spare you the list of medical issues.)I am not going to appoint a successor.
[...] I'll still be here, but I'm trying to let you all figure something out for
yourselves. I'm tired, and need a very long break.
(Score: 2) by HiThere on Friday July 13 2018, @06:00PM (4 children)
For that particular use case, you have an argument. There are many others, however, where assignment to a variable within an expression is beneficial. And there are reasonable arguments that it shouldn't be a simple equal sign, as that increases the number of errors. (Suppose you have a sticky equal sign...extraneous doubles would be uncomfortably frequent, and easy to miss.) Requiring a colon-equal (":=") minimizes the likelihood of this problem. This allows a greater number of errors to be detected during the syntactic pass.
P.S.: I don't know if those were his arguments. They're the ones that occur to me off the top of my head. I doubt that Pascal usage played any part.
Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
(Score: 3, Insightful) by Thexalon on Friday July 13 2018, @06:12PM (3 children)
The other obvious way to handle those situations is to make the assignment and the expression two separate statements, because this really is syntactic sugar we're talking about here.
In short, this:
Versus this:
It is definitely a matter of taste and opinion which one is clearer.
Vote for Pedro
(Score: 1, Interesting) by Anonymous Coward on Friday July 13 2018, @07:10PM (2 children)
That is true, and a large part of the rationale comes from real world examples suggesting people write code that prefers fewer lines even over more efficient alternatives. Things like
or
generally the new syntax allows for code that is both more readable and more compact. (Once familiar with the new := operand) Those exampels come from the pep, there are many more showing clean improvements it enables in the python source code itself.
(Score: 1, Interesting) by Anonymous Coward on Friday July 13 2018, @07:25PM (1 child)
They got sick of people monkey patching the standard lib to use an LRU cache on compiled re patterns or complaining about the performance, so they added it themselves. If you are really concerned about performance from standard constructs like that, then either the programmer or core devs could just do it for that one too. It's even in the same module.
Your second example is much more readable to me using the suggested alternative rather than the accepted one, plus it has better scoping rules, among other benefits:
vs
(Score: 0) by Anonymous Coward on Friday July 13 2018, @07:27PM
Oops, made some mispels in the last two examples on variable names, but the syntax is correct and my point still stands.