Difference between delete and doDelete?

Hi y’all, first post here:

I’m writing a script that cleans up an animated rig in Maya for export to a game engine. Basically, it bakes animation down and deletes everything but the skeletal hierarchy and whatever is skinned to it.

Weird thing is, the skinning breaks when I run cmds.delete(list of objects to delete). However, if I do cmds.select(list of objects to delete) and then mel.eval(“doDelete”), nothing breaks. I have no idea why this happens. Is doDelete doing something (or not doing something) that delete does?

Yes, it does some checks for references and skin clusters before running delete. You can see the code at C:\Program Files\Autodesk\Maya2014\scripts\others\doDelete.mel (or wherever the equivalent on your system is).