"Upcoming Python Features Brought to You by Python Enhancement Proposals"

A fun overview of some interesting new features coming to Python.

Another syntax change proposal is PEP 654, which proposes except* as a new syntax for raising groups of exceptions. The rationale for this one is that Python interpreter can only propagate one exception at the time, but sometimes multiple unrelated exceptions need to be propagated as the stack unwinds.

Yes, please!

Next one is PEP 678 which suggests that __note__ attribute should be added to BaseException class. This attribute would be used to hold additional debugging information which could be displayed as part of traceback.

Yes, yes!

Some great stuff, but I also worry about feature creep. The proposal for changing the syntax for default function arguments is interesting, but fairly opaque to a non-expert:

def process_data(file=>obj_store):
	...

That looks pretty cryptic to me.

One of the strengths of Python is the simplicity of the syntax. The best code can read almost like pseudocode, letting non-Python programmers get the basic idea. Python is then easy to read, fun to write, and great for teaching. But these syntactic sugar enhancements, great as they tend to be, do risk taking away some of those less-is-more features.

This change looks reasonable and useful to me, but I think we should be cautious of adding too many new syntax notations/changes. It’s questionable whether small improvement like this one warrants yet another assignment operator.

Exactly.

https://martinheinz.dev/blog/67

Jim Bagrow
Jim Bagrow
Associate Professor of Mathematics & Statistics

My research interests include complex networks, computational social science, and data science.

Next
Previous

Related