py scripts - replace bad uses of len(),
checking if the collection is True is faster since it only checks if it has at least one item, rather then going over all items.
This commit is contained in:
@@ -239,7 +239,7 @@ class ClearUselessActions(Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return len(bpy.data.actions) != 0
|
||||
return bool(bpy.data.actions)
|
||||
|
||||
def execute(self, context):
|
||||
removed = 0
|
||||
|
||||
@@ -158,7 +158,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
|
||||
row = layout.row()
|
||||
row.prop(group, "name")
|
||||
|
||||
if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
|
||||
if ob.mode == 'EDIT' and ob.vertex_groups:
|
||||
row = layout.row()
|
||||
|
||||
sub = row.row(align=True)
|
||||
|
||||
@@ -219,7 +219,7 @@ class InputKeyMapPanel:
|
||||
|
||||
filtered_items = [kmi for kmi in km.keymap_items if filter_text in kmi.name.lower()]
|
||||
|
||||
if len(filtered_items) != 0:
|
||||
if filtered_items:
|
||||
col = layout.column()
|
||||
|
||||
row = col.row()
|
||||
|
||||
Reference in New Issue
Block a user