larray-project / larray

N-dimensional labelled arrays in Python
https://larray.readthedocs.io/
GNU General Public License v3.0
8 stars 6 forks source link

implement filter argument to arrays() and friends #865

Open gdementen opened 4 years ago

gdementen commented 4 years ago

So that we can have code like this:

arrays(['arr1', 'arr2']).save('fpath.h5')

instead of:

arrays()['arr1', 'arr2'].save('fpath.h5')
alixdamman commented 4 years ago

This a request by one of our users?

Whatever the answer is, I'm OK with this issue. I'm curious.

gdementen commented 4 years ago

yes indeed 😄 Johan wants an easier way to save a few variables from the local scope to a file.

Session(arr1=arr1, arr2=arr2) is indeed a bit cumbersome when you have many, so the best I could come up with is: arrays()['arr1', 'arr2'].save('path.h5') but a filter while creating the session would be a bit more elegant.