Guido van Rossum, the Benevolent Dictator for Life of the Python project, has stepped down.
I'm not sure this has happened before. The leader of the Python language project has put himself on
permanent vacation, mostly because he's tired. It appears that the straw that broke the camel's back was a recent Python Enhancement Proposal which met with a lot of opposition.
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. ~ Guido van Rossum
The PEP in question provides syntactic sugar to allow re-use of a hard-to-compute value. It's supposed to work with other syntactic sugar like list comprehensions. Here's an example of when it would be useful (taken from the PEP itself):
group = re.match(data).group(1) if re.match(data) else None
Note how the
re.match() is done twice to fit this into one line. You could do it more verbosely:
match = re.match(data) group = match.group(1) if match else None
PEP 572 lets you write it this way (or it should; as far as I know this is not yet implemented):
group = (match := re.match(data).group(1)) if match else None
You can see that the assignment is done within the parentheses in the middle of the expression, leaving you a more concise result. At the same time you can see how this is uncomfortably dense - maybe this isn't the right way to do it. It's harder to read. One compelling example from the PEP:
while chunk := file.read(8192): process(chunk)
This is clearly better than the alternative:
chunk = file.read(8192) while chunk is not None: process(chunk) chunk = file.read(8192)
So I think this PEP is a good thing. Clearly it improves some use cases. It remains to be seen whether or not Guido's leaving his position will turn out to be a good thing. We'll have to see what sort of decision making process emerges in Guido's absence. I'm interested to see where it goes.