mphowardlab / relentless

Computational materials design, with less code.
https://relentless.readthedocs.io
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

Use variable name rather than variable object #184

Open mphoward opened 1 year ago

mphoward commented 1 year ago

In places where we use the variable object as a key, we should consider replacing it with the variable name. This will be helpful for serializing to file and reconstructing objects from file. However, there could be ramifications where places where we use is to test for objects, and we need to consider whether that will be less convenient. For example:

if x in gradient

vs.

if x.name in gradient

It might be possible to specially define the __getitem__ method to reinterpret variables to use their name, though, and retain the first behavior.