Post

How do you collapse runs of adjacent spaces in Python? That is, shorter runs of 2+ consecutive spaces so there's only 1 space there? I can't come up with a simple/straightforward way to do it with `str.join` and I'm surprised... What am I missing?

Yup - it's a bit of a gotcha that specifying a separator has different behaviour than the default. For the re I'd be tempted by " {2,}" - bit more explicit, more configurable and on normally spaced strings less replacing to do.

Not sure I follow what you mean by “on normally spaced strings less replacing to do”. I like " {2,}" because it's easy to miss the double space in the original " +"... I'll replace it, thanks!