There are a few immutable objects that are frequently used, namely: Element. There's no reason that these instances couldn't be shared so a "singleton-like" pattern might help save memory.
I confirmed this was note the case:
In [1]: import montepy
In [2]: el1= montepy.data_inputs.element.Element(92)
In [3]: el2= montepy.data_inputs.element.Element(92)
In [4]: hex(id(el1))
Out[4]: '0x7fa5c7d14410'
In [5]: hex(id(el2))
Out[5]: '0x7fa5f8b4f770'
There are a few immutable objects that are frequently used, namely:
Element
. There's no reason that these instances couldn't be shared so a "singleton-like" pattern might help save memory.I confirmed this was note the case: