nansat
nansat copied to clipboard
Make Nansat immutable
There was a suggestion on Nansat lectures to make Nansat immutable: https://github.com/nansencenter/nansat-lectures/issues/3
That implies that reproject, crop, etc do not change the object but rather return new, modified object. Two Advantages:
- it is possible to reason about n without tracing all possible mutations;
- you can express multiple processors starting at n without worrying that one will mutate n and make it unusable for the other;
- Operations can be easily chained: n.reproject(...).write_figure(...)
- Assurance during processing by tiles in a distributed (cluster) environment
Something to read about: http://programmers.stackexchange.com/questions/151733/if-immutable-objects-are-good-why-do-people-keep-creating-mutable-objects
+1 seems a more logical approach
+1 yes, these are good arguments.
2016-03-17 9:49 GMT+01:00 Aleksander Vines [email protected]:
+1 seems a more logical approach
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/nansencenter/nansat/issues/164#issuecomment-197768571