Mercurial > pytave
comparison @pyobject/pyobject.m @ 373:0e4097c66788
Report a Python object's fully qualified class name correctly
* oct-py-util.cc (pytave::py_object_class_name): Return the correct fully
qualified class name, including module prefix.
(pytave::is_py_kwargs_argument): Check for class name "__main__._OctaveKwargs".
* __py_struct_from_dict__.cc (F__py_class_name__): New function.
* @pyobject/methods.m (pyobject.methods): Use __py_class_name__.
* @pyobject/pyobject.m (pyobject.class): Likewise.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 26 Aug 2016 14:05:37 -0700 |
parents | 9d7188514f2c |
children | d362cdd1ddeb |
comparison
equal
deleted
inserted
replaced
372:b20b8cf8ad07 | 373:0e4097c66788 |
---|---|
94 varargout = {s}; | 94 varargout = {s}; |
95 endif | 95 endif |
96 endfunction | 96 endfunction |
97 | 97 |
98 function s = class (x) | 98 function s = class (x) |
99 idx = struct ("type", ".", "subs", "__class__"); | 99 s = __py_class_name__ (x); |
100 class_ref = subsref (x, idx); | 100 s = sprintf ("py.%s", s); |
101 idx = struct ("type", ".", "subs", "__name__"); | |
102 s = subsref (class_ref, idx); | |
103 s = sprintf ("py.%s", char (s)); | |
104 endfunction | 101 endfunction |
105 | 102 |
106 function y = double (x) | 103 function y = double (x) |
107 if (isa (x, "py.array.array")) | 104 if (isa (x, "py.array.array")) |
108 c = cell (x); | 105 c = cell (x); |