Add protocols for array object methods#69
Conversation
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
- DLPack export via `HasDLPack` - Indexing via `HasGetItem` - Indexed assignment via `HasSetItem` - Device transfer via `HasToDevice` Also composes these protocols into `Array`, exports them from the top-level package, and adds NumPy integration assignments for the new protocol surfaces.
| from ._array import ( | ||
| Array, | ||
| HasArrayNamespace, | ||
| HasDevice, | ||
| HasDType, | ||
| HasMatrixTranspose, | ||
| HasNDim, | ||
| HasShape, | ||
| HasSize, | ||
| HasTranspose, | ||
| ) | ||
| from ._array import Array, HasArrayNamespace, HasDType |
There was a problem hiding this comment.
could you elaborate on the implications of removing these here and composing them into Array instead?
There was a problem hiding this comment.
Did you want to expose them for some reason? I thought they were internal details?
And don't you ultimately want Array to imply all of the protocols?
There was a problem hiding this comment.
what is the reason for exposing HasDType but not HasShape, for example?
There was a problem hiding this comment.
That was the state of the line before my change, and I didn't want to change it. But yes, as far as I know, there is no reason to expose it either.
There was a problem hiding this comment.
cool. Could you add a review comment to gh-34 which suggests to stop exposing all of them?
There was a problem hiding this comment.
I'll add a question 😄
Once you finish #34, could someone take a look this? @jorenham @lucascolley @nstarman
Add protocols for array object methods:
HasDLPackHasGetItemHasSetItemHasToDeviceAlso composes these protocols into
Array, exports them from thetop-level package, and adds NumPy integration assignments for the new
protocol surfaces.