in reply to Working Solo and in a Team

I think the closest most people come to pair programming is an (often mandatory) code review process.

I love to do code review, and love to receive it. However power imbalance tends to weaken the value of code review in two ways. When (as it often is) the reviewer is a more experienced or more senior developer, the reviewee can perceive the review comments as a set of instructions. And when the roles are reversed, the reviewer will tend to restrict their comments to blatant bugs or typos: they will rarely feel confident enough to question everything that isn't clear to them, even though they may be expected to maintain it in the future.

Here's the psychological safety aspect: for a code review to be truly productive it should be a dialogue.

If a code review comment says "why did you do it this way rather than this other way", most people's instinctive reaction is to change to "this other way", when a preferable response would be a) to explain why you did it this way, or b) propose a modification that adds a comment explaining why it was chosen to do it this way. If there are arguments to be made either way, then have that discussion until consensus is reached (or if time does not permit, at least add a comment that the other way is worth considering).

When code review works well, multiple benefits are achieved simultaneously: the quality of the eventually submitted code improves; the reviewee learns something; the reviewer learns something; and the record of the review process serves as a useful historical document helping to explain why the code now looks as it does.

I have never experienced pair programming; I can guess that it needs a lot of respect and trust from both parties. But while I can imagine it resulting in better code (similar to a good review process), my guess is that it is less likely to result in the documentation improvements that a good review process can bring - I think that's a particular benefit to bringing in a fresh pair of eyes at the point the originator(s) consider a piece of work complete.