import bpy
for b in bpy.context.selected_pose_bones:
for c in b.constraints:
if c.type == "STRETCH_TO":
c.rest_length = 0
EDIT: Or you can do…
import bpy
for b in bpy.context.active_object.pose.bones:
for c in b.constraints:
if c.type == "STRETCH_TO":
c.rest_length = 0
That resets all the stretch to’s in the selected armature, even if they’re not selected, or on an off layer.