On Mar 13, 2015 7:22 AM, "Daniel Smith" <dgasm...@icloud.com> wrote:
>
> Greetings everyone,
> I have a new project that deals with core and disk tensors wrapped into a
single object so that the expressions are transparent to the user after the
tensor is formed. I would like to add __array_interface__ to the core
tensor and provide a reasonable error message if someone tries to call the
__array_interface__ for a disk tensor. I may be missing something, but I do
not see an obvious way to do this in the python layer.

Just define your class so that attempting to access __array_interface__
raises an error directly:

class DiskTensor(object):
    @property
    def __array_interface__(self):
        raise TypeError(...)

-n
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to