pyiron / pyiron_workflow

Graph-and-node based workflows
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

`NotData` as singleton instead #179

Closed liamhuber closed 9 months ago

liamhuber commented 9 months ago

The original motivation was to get the non-data data working better with h5io, but I actually like the singleton better than using a raw class. Also the is comparisons all keep working, since it's literally the same instance.

Defining __reduce__ allows pickle to get back the exact same global instance defined alongside the singleton class.

After @samwaseda's addition (#185), I start to wonder if this is actually something that would be nice to have generically available in snippets?

review-notebook-app[bot] commented 9 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

github-actions[bot] commented 9 months ago

Binder :point_left: Launch a binder notebook on branch _pyiron/pyiron_workflow/notdata_assingleton

samwaseda commented 9 months ago

After @samwaseda's addition (#185), I start to wonder if this is actually something that would be nice to have generically available in snippets?

Yes, I was about to post this comment, but then also thought since it's only used in the context of channels and it's anyway not visible to the user, I think we can postpone the discussion for now. As soon as we see a potential merit to have it in snippets, we can easily move it.