particles attributes now return reference instead of copy
ce7207c5da1b25103eecda7104628b65646f8270 has changed p.x from returning a copy to returning a reference to data. This introduces different behaviour for in-memory sets and in-code sets, difference between grids and Particles, and issues with subsets:
p=Particles(5)
p.x=range(5)
tmp=p.x
print tmp is p.x
#behaviour of index expressions
tmp=p[::2].x
p.x=p.x+1
print tmp == p[::2].x
tmp=p.x[::2]
p.x=p.x+1
print tmp == p[::2].x
# behaviour of grids
p=Grid(5)
p.x=range(5) | units.m
tmp=p.x
print tmp is p.x
gives on 4168ed99b8ccc163a5f9311722c6f28b7c1aeee4:
False
[False False False]
[False False False]
False
while on ce7207c5da1b25103eecda7104628b65646f8270:
True
[False False False]
[ True True True]
False
Which of the two is the desired behaviour?
for me consistency between in-memory and code sets is most important..
still relevant
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.