Families of commuting automorphisms, and a characterization of the affine space