iirc, it was around 5-10 µs per iteration on my MBP. I thought I might as well use the more efficient code, but in this case I lost sight of the fact that this helper is only used when wsgi.file_wrapper is not available, and in that case the transfer is going to be less efficient anyway, making a few extra µs less important.

The while loop is quite short, so it should only be slightly less clear that no state modifications are happening. But given what I just said above, I don't think it is worth explicitly defining a generator after all.