Working with a large number of objects (enough to create performance issues) and planning on assigning custom properties to them at unpredictable, disconnected intervals. Would like to return a list of any “tagged” objects in the scene rapidly. Ideally the implementation would involve a process similar to an SQL-like WHERE statement.
That was my initial thought. But not easily - nor is it necessary. TLDR, instantiating/using that list proved complicated since I needed access across multiple modules & unpredictable state changes. This prop helps avoid all that. For more details, see this solution based off this discussion and another.
objs_list = [obj for obj in bpy.data.objects if "prop_name" in obj and obj["prop_name"] == 1]
in your code over on StackExchange may return an error if the object does not have the custom Property “prop_name”, you might be better with this:
objs_list = [obj for obj in bpy.data.objects if "prop_name" in obj]
set_objs_list = [obj for obj in objs_list if obj["prop_name"] == 1]
That way you make sure the Customer Property exist first, I haven’t tested your combined query, but it raised a quick flag, that it might not work, I may be wrong of course, it may be OK… Just test it with some objects that don’t have the Custom Property “prop_name”.
I would assume that Python, like the vast majority of other modern programming languages, has boolean short-circuiting. The second conditional of the and expression won’t be evaluated if the first conditional evaluates to false. IOW, no errors for objects without the property.
Unless you are referring to some nuance of Python that I’m not familiar with…