The answer in this post describes it best:
Why does "for point in part:" work in a standalone ArcPy script, but not in the Field Calculator?
The difference in behavior is due to the fact that objects within geoprocessing tools are not the same as objects within ArcPy. The pattern of directly iterating over items in a container, for point in part:, is a Python use pattern that is implemented in most ArcPy classes but not in ArcObjects classes being used by geoprocessing tools.
The geoprocessing array does not implement the __iter__ special method while ArcPy Array does implement it.
Could ESRI please enhance the geoprocessing array so that we can directly iterate over items in a container?
yes! or just read arrays directly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.