If you don't know the exact name or position, I can't think of another way than simply looping over everything that's there and checking for likeness. There may be some inefficiency in your code that could be improved. Feel free to post a snippet of what you're doing.
I thought so [sigh...]
I am using a two-step approach:
first selecting feature classes based on name and then looping through the list with a search cursor:
fcList = arcpy.ListFeatureClasses(sSearchStr,"POLYGON")
for fcls in fcList:
cnt = len([r for r in arcpy.da.SearchCursor(fcls, fieldname, where_clause = query)])
if cnt > 0:
Would be great if you have an idea how to speed up this process!
Are you sure the slowness is coming from ListFeatureClasses()? If so, maybe try arcpy.da.Walk()
If not, it might be the counting of records that's slow. @JoshuaBixby posted a blog article a while back concerning the performance of counting records. Unfortunately, the formatting was lost in transition to the new Geonet forum but he summarizes in the comments that:
If you can reach back to the layer, feature layer, feature class, table view, or table; then the Get Count tool is by far the quickest method.
However, it does look like you're applying a where_clause so you'd probably have to make a selection first for get count, which would likely negate the performance gain. Maybe try ArcSDESQLExecute() with a where clause and count?
Thanks to all of you, there are a number of interesting points to check now. Thankfully first I will be off to the mountains for a week or so and will tackle that problem when I'm back