Set inverse Child OF constraints via python
Toggle a constraint property

As mentioned, simply changing the inverse_matrix property does nought.  If another property of the constraint is toggled, for example the target it appears to work as expected, using the new value assigned to inverse_matrix  

Test script, tested on simple example of single bone and default cube parent. Set cmd to 'CLEAR' for clear and 'SET' for set.

EDIT:  code to interpolate based on constraint influence when set.

import bpy
from mathutils import Matrix

context = bpy.context

ob = context.object
constraints = [(pb, c) for pb in ob.pose.bones
        for c in pb.constraints if c.type == 'CHILD_OF']

cmd = 'SET' # or 'SET'       
for pb, c in constraints:

    if cmd == 'CLEAR':
        c.inverse_matrix = Matrix.Identity(4)    

    elif cmd == 'SET': 
        if c.target:
            M = ob.convert_space(pose_bone=pb, 
                    matrix=c.target.matrix_world,
                    from_space='WORLD',
                    to_space='POSE')
            P = Matrix.Identity(4).lerp(M, c.influence)
            c.inverse_matrix = P.inverted()
    # toggle a property
    target = c.target
    c.target = None
    c.target = target
    #pb.constraints.update()


why is this so?  Constraint properties that are set by a user (esp via UI) update the data appropriately on change.  

An operator for each has been  chosen to crunch the numbers , and handle the necessary updating.  Perhaps a patch to make the python attribute update on change, not sure..