I agree that sometimes (especially with some skittish species) that painting sides is a good idea. It also can prevent fish from becoming startled by a shadow or sudden movement, and gobbling down the eggs or fry.
With some species, if I have a pair but they are super skittish, I paint a piece of styrofoam insulation black, and tape to the front of the tank, and leave a peephole for observation.
And because I live in a cold climate, I tend to tape insulation to 3 sides and the bottom of almost all my tanks to help maintain temp in winter, as opposed to painting the glass.