Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Nested Cursor- why is it bad?

$
0
0
Hi Everyone,

I have heard nested cursors are bad. Why is that? If I want to test if a point is in a particular polygon wouldn't I need nested cursors?
Something like this would work well. Why is nested cursors not a good idea? Thank you for your help

Code:

for row1 in arcpy.SearchCursor(shapefile1):
    for row2 in arcpy.SearchCursor(shapefile2):
        if row1.shape.contains(row2.shape):
            return True

Luke Kaim

Viewing all articles
Browse latest Browse all 2485

Trending Articles