You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I've been functionality of Featureset.Features to try to avoid using the iterator style of getting features at a point on a map, but it appears that this functionality, as it is exposed to Python, is still using an iterator internally and doesn't reset it after you call Featureset.Features for the first time. I've attached a test case that demonstrates that the len() of a feature list changes after checking it once.
The text was updated successfully, but these errors were encountered:
[springmeyer] ya, this is poorly exposed in python. the root issue is that the internal c++ call to a datasources next() is not a standard iterator, so its hard to know how to properly expose.
workaround is pull out a python list once and assign it to a new variable:
[tmcw] Okay, after bashing my head against this issue for an hour or two, I realized that I was totally missing why this is actually hard to do.
One possible solution: instead of exposing features as a list, it might be useful to expose features as an object with init exposed. This would make it a bit more similar to built-in iterators like when you can do
{{{
for x in file('blah.txt')
}}}
since actually assigning a name to that iterator and running it twice gives the same behavior as featureset, and running len(file('blah.txt')) correctly states that file doensn't support len.
So, I've been functionality of Featureset.Features to try to avoid using the iterator style of getting features at a point on a map, but it appears that this functionality, as it is exposed to Python, is still using an iterator internally and doesn't reset it after you call Featureset.Features for the first time. I've attached a test case that demonstrates that the len() of a feature list changes after checking it once.
The text was updated successfully, but these errors were encountered: