[python] searching for a layer name using wildcard doesn't seem to work

We have collectively spent several minutes on this thread ; sufficient to search tens of millions of layers :open_mouth:

The reason I asked to add print somewhere in the loop is because you’re not just searching you do something with the result. If you optimize the search as much as possible you optimize the whole process. Every unnecessary iteration means slowdown.

Whether you iterate the layers and look for a certain object or you iterate all object searching for a certain object and getting its layer matters. And the complexity is different.

Yes, but in general if you are searching for something(s) and you expect one or more matches out of a larger pool, it’s better to do the whole search routine and simply reference the matched items in a list, then once you have that, you can go back to the matched items and do what you need.

1 Like