Select deform bones only

A have armature. And i need button for select all only deform bones.


# This construction work!

arm = bpy.context.active_object.data
     for bone in arm.bones:
          bone.select = False

# But how make work this?

class Select_Deform_Disabled(bpy.types.Operator): 
     bl_idname = "sel_def_dis.button" 
     bl_label = "Select all deform bones disabled" 

     def execute(self, context): 
          all_bones = bpy.context.active_object.data

          for def_bone in all_bones:
               if def_bone.deform == True: # problem here! How get access to defom parameter?
                    def_bone.select = True
               else:
                    def_bone.select = False
          return{'FINISHED'}

You can either hover over the checkbox to see the python tooltip or right click and click Online Python Reference.

use_deformEnable Bone to deform geometry


Type:	boolean, default False

So check if use_deform is False or not.