You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the meeting today I mentioned that we could use hooks from __new__ and __init_subclass__ to automatically infer the desired dataset-subclass.
Currently we have two Datasets which are being used SQLiteDataset and ParquetDataset, and they both take the same inputs arguments.
I think we could overwrite __new__ and __init_subclass__ in Dataset in such a way that __init_subclass__ would make a "subclass registry", which connects file-extensions to implemented datasets, and then __new__ would look up the subclass registry and find the correct subclass to instantiate.
A "simple" illustration of how this would look like
I think it would be easier for end-users to interact with the library, since they only need to create a Dataset, and don't need to worry about finding the correct subclass for their data back-end.
Cons:
We restrict ourselves to have all datasets take the same arguments/keyword arguments
We restrict ourselves to only have one dataset per file extension. (This can somewhat be circumvented, but it is not as elegant)
It might be slightly more difficult to debug a dataset object, because it is not completely straightforward which subclass it is.
The text was updated successfully, but these errors were encountered:
At the meeting today I mentioned that we could use hooks from
__new__
and__init_subclass__
to automatically infer the desired dataset-subclass.Currently we have two Datasets which are being used
SQLiteDataset
andParquetDataset
, and they both take the same inputs arguments.I think we could overwrite
__new__
and__init_subclass__
inDataset
in such a way that__init_subclass__
would make a "subclass registry", which connects file-extensions to implemented datasets, and then__new__
would look up the subclass registry and find the correct subclass to instantiate.A "simple" illustration of how this would look like
Pros:
Cons:
The text was updated successfully, but these errors were encountered: