Re:Copying data is wasteful, mutating data is dangerous
by UncleEntity on Thursday January 09, 2020 @04:55PM
(#22006334)
The pythonic way would be to have sort() and sorted() which either sort in place or return a sorted copy. Best of both worlds.
I think this is something that is a slightly less obvious when dealing with classes. I see stuff like this in academic code all the time:
I'd much prefer for there to be variable `self.data_normalized` which is initialized to None or even better a getter `getNormalizedData()` that computes/caches a normalized variable.