-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving away from accessors #15
Comments
Sure, I wasn't necessarily concerned about interoperability with type checking or text editor auto-completion when I wrote this. Mostly it just felt natural for many of these features to be attached as methods or properties to DataArrays and Datasets -- this was particularly true for the The most useful aspects of that code outside xpartition* are probably
Of course. My point here was more in defining separate functions for DataArrays and Datasets. Defining single functions that attempt to work on both has been error prone in my experience (and sometimes some arguments are only relevant for one case or the other). To me there is a minor difference between writing *There is probably another discussion to be had around what (if any) low-level features of xpartition should be part of the public API. |
Oh. I absolutely agree about this. |
Some limitations of accessory came up on #14.
That PR is fine, but I would like to advocate against letting accessors constrain the design of this package too much. I agree accessors can make something more discoverable in an interactive environment and may feel "cleaner", but otoh they tend to break static analysis like type checking or auto-completion in an editor. For the same reason, it requires an unused import
import xpartition
that gets flagged by flake8. At the same time they encourage writing classes for things that could be functions...which is a bit of a red flag in any other context. Re namespacing...that can be done with python modules, and I don't see much difference betweenxpartition.write(ds, ...)
andds.partition.write
. Overall, I think accessors are a bit of step backwards from plain pythonimport
on several fronts, and one of the xarray features that is more optimized for the interactive environment at the expense of long-term maintainability.The text was updated successfully, but these errors were encountered: