tobac icon indicating copy to clipboard operation
tobac copied to clipboard

Unexpected Alteration of Objects

Open lettlini opened this issue 1 year ago • 0 comments

I noticed that there are functions which directly alter arguments of type array-like. In the case of numpy-arrays this can result in the object being changed outside the function's scope. An example for this behavior is: https://github.com/tobac-project/tobac/blob/43060c2ecc25df64a04eb889b25d653d8e538037/tobac/testing.py#L684-L689

I think that this kind of behavior can be quite unexpected since the function has an explicit return statement.

A suggestion I would make is to either include a note in the docstring or create a copy of the referenced object before changing it.

lettlini avatar Apr 12 '23 14:04 lettlini