that’s actually a really cool trick — the many with-usages (like locks!) are a huge boon to understandable code.
And while it took me 25 lines of code to implement this with with wisp ( hg.sr.ht/~arnebab/wisp/browse/… ) it’s only Python where that’s the default way to do things.
(there is no superfluous with in the previous paragraph ☺)
Being able to add stuff like this to the language cleanly is why I started to move my personal projects from #Python to #Guile #Scheme in 2013, though.