comparison @pyobject/fieldnames.m @ 284:6c133bcac33a

use pyobject instead of accessing the InOct dict * @pyobject/fieldnames.m: Use our tools. * @pyobject/methods.m: Use our tools. * @pyobject/pyobject.m (@pyobject/whatclass): Use our tools.
author Colin Macdonald <cbm@m.fsf.org>
date Tue, 02 Aug 2016 00:03:51 -0700
parents b1f874a68e0f
children 49832ca978fd
comparison
equal deleted inserted replaced
280:3bf799e80ca5 284:6c133bcac33a
45 ## @end defmethod 45 ## @end defmethod
46 46
47 47
48 function names = fieldnames (x) 48 function names = fieldnames (x)
49 49
50 cmd = sprintf (["[a for x in (__InOct__['%s'],) for a in dir(x) " ... 50 cmd = pyeval (["lambda x: [a for a in dir(x)" ...
51 " if not callable(getattr(x, a))" ... 51 " if not callable(getattr(x, a))" ...
52 " and not isinstance(getattr(x, a), __import__('types').ModuleType)" ... 52 " and not isinstance(getattr(x, a), __import__('types').ModuleType)" ...
53 " and not a.startswith('_')]"], 53 " and not a.startswith('_')]"]);
54 getid (x));
55 54
56 # FIXME: may need to convert from Python list to Octave cell array 55 # FIXME: may need to convert from Python list to Octave cell array
57 names = pyeval (cmd); 56 names = pycall (cmd, x);
58 names = names(:); 57 names = names(:);
59 58
60 endfunction 59 endfunction
61 60
62 61