On Fri, May 15, 2020 at 05:44:59PM -0700, Andrew Barnert wrote:
Once you go with a separate view-creating function (or type), do we even need the dunder?
Possibly not. But the beauty of a protocol is that it can work even if the object doesn't define a `__view__` dunder.
- If the object defines `__view__`, call it; this allows objects to return an optimized view, if it makes sense to them; e.g. bytes might simply return a memoryview.
- If not, fall back on a generic view object that just does index arithmetic and delegation.