python iterators an ensemble pybind11 wrappers #142
pavlis
started this conversation in
Design & Development
Replies: 1 comment 1 reply
-
Well, the point here is that Python is always pass-by-reference, so |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the latest work on the getting started tutorial I ran across something fundamental. I think it is a pybind11 wrapper issue, but it may be a feature of python itself I don't understand. Consider this code I just revised for the tutorial:
In the form above it works fine. The problem comes from this construct in that code:
Putting "ensemble.member[i]" on the right does the right thing. If I replace it by the line above I have commented out WindowData is ignored. I presume the reason is that the symbol d is assigned a new value, it no longer points at "member[i]" so it is just discarded the next time through the loop. Clearly the python iterator is not the same thing as the C++ version of a vector container iterator:
vector<TimeSeries>::iterator d;
.This will confuse our users. If we can't fix it we must document it clearly.
Beta Was this translation helpful? Give feedback.
All reactions