Writing Rust-style Python

This post by @kobzol highlights some good methodologies for writing Python in a more defensive manner.

I learned that typing.assert_never allows one to inform their IDE/type checker about code which should be unreachable.

Similarly, simpler Union typing and the existence of the pyserde package make for more powerful access to data - but I’ll have to test serde against the venerable pydantic which has been my go-to for the longest time.

A good read for sure!

#python #rust #programming