I did notice that in arcpy the Array object is not iterable. I had to use the .next() function. Should I expect it to be iterable?
while row:
feat = row.getValue(shapefield)
qInterior = False
for partNum in range(feat.partCount) :
part = feat.getPart(partNum)
qInterior = False
for ptNum in range(part.count):
pt = part.next()
if pt != None:
arrayOuter.add(pt)
else :
qInterior = True
break # ignore donut vertices
arrayObj.add(arrayOuter)
arrayOuter.RemoveAll()
Heres an easy way to make arcpy non iterable objects usable in a for each loop.
for each in iter(lambda: <your object>.next(), None):
This basically iterates through getting the next element until the termination condition of the element being None is met.
while row:
feat = row.getValue(shapefield)
qInterior = False
for partNum in range(feat.partCount) :
part = feat.getPart(partNum)
qInterior = False
# to iterate you can use the iterable wrapper in
# conjunction with a lambda.
for pt in iter(lambda: part.next(), None):
qInterior = True
arrayOuter.add(pt)
# old method
for ptNum in range(part.count):
pt = part.next()
if pt != None:
arrayOuter.add(pt)
else :
qInterior = True
break # ignore donut vertices
arrayObj.add(arrayOuter)
arrayOuter.RemoveAll()
For the comtypes bug not generating esriSystem.Array its because of namespace pollution that comtypes generator does.@RiversideCan you tell me if your version of comtypes is actually generating any sort of builtin methods like len/iter/getitem/etc, for enumerable interfaces? Some Interfaces do, but the majority don't.