Remove Shape_Keys (KeyBlocks) without Ops

¿How can I remove Shape Keys from a Mesh without Ops?
I can only mute them.


newme = bpy.data.meshes.new_from_object( sc, ob, False, 'PREVIEW' )
                    if newme.shape_keys != None :
                        knam = newme.shape_keys.name
                        for k in bpy.data.shape_keys[ knam ].key_blocks.keys():
                            skey = bpy.data.shape_keys[ knam ].key_blocks[ k ]
                            print ("Muteando %s" % skey.name)
                            skey.mute = True

Thanks!!

there is no low-level function to remove a shapekey, so you need to do something like:

ob.active_shape_key_index = 2 # you need to obtain this index number before
bpy.ops.object.shape_key_remove()

Thanks CoDEmanX, on another forum Oscurart tells me that is a way, but is unsafe:

bpy.data.shape_keys[].key_blocks[].user_clear()

hm that only clears users, but objects might still use the data and as soon as blender tries to access that data, it is going to crash. So better use the operator and maybe annoy the devs to provide a low-level API method for removing them.