On Tue, Mar 8, 2022 at 8:27 AM Stefan van der Walt <stef...@berkeley.edu> wrote:
> In other places in the ecosystem, like pandas and xarray, `from_x` and > friends live as static methods on their respective classes. Any reason not > to add this as `numpy.array.from_dlpack`? We may also want to consider > adding all the other `from*`'s there and deprecating the original usage > (without removing it). > Pandas and Xarray make almost everything else a method, too, and encourage using "method chaining" for manipulating datasets. So I'm not sure they are great precedents here. I think static/class methods are a fine way to write constructors, but are not inherently superior. My vote would be to keep it as a function for consistency with existing numpy constructors like frombuffer. It might even make sense to call it np.fromdlpack, though the underscore really does increase readability.
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com