LinearSpaceElement.assign

LinearSpaceElement.assign(other, avoid_deep_copy: bool = False)[source]

Assign the values of other to self, like self[:] = other.

If avoid_deep_copy is True, an attempt is made to reuse the storage of other for self. This is in general unsafe (later modifications to self would impact also other, vice versa), but faster and useful particularly when other is ephemeral (rvalue, in C++ terminology).

Spaces with immutable elements (i.e., in_place=NOT_SUPPORTED in supported_num_operation_paradigms) may opt for performing only a shallow copy even if avoid_deep_copy is False. On the other hand, if some type conversion is necessary on other then this will usually prompt a copy even if avoid_deep_copy is True.