Removing all material slots in one go
You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():

for obj in bpy.context.selected_editable_objects:
    obj.active_material_index = 0
    for i in range(len(obj.material_slots)):
        bpy.ops.object.material_slot_remove({'object': obj})