Skip to content

[FEATURE] - Make numpy arrays immutable like other attributes #83

@coltonbh

Description

@coltonbh

This could be in a model post-init pydantic validator for qcio objects with numpy arrays or perhaps could get set as a SerializableNDArray annotation?

Describe the solution you'd like

# Make numpy arrays immutable
>>> import numpy as np
>>> a = np.array([1,2,3])
>>> a.flags.writeable = False
>>> a[1] = 3
Traceback (most recent call last):
  File "<python-input-7>", line 1, in <module>
    a[1] = 3
    ~^^^
ValueError: assignment destination is read-only

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions