diff @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
line wrap: on
line diff
--- a/@pyobject/fieldnames.m	Fri Jul 29 20:15:39 2016 -0700
+++ b/@pyobject/fieldnames.m	Tue Aug 02 00:03:51 2016 -0700
@@ -47,14 +47,13 @@
 
 function names = fieldnames (x)
 
-  cmd = sprintf (["[a for x in (__InOct__['%s'],) for a in dir(x) " ...
-                  " if not callable(getattr(x, a))" ...
-                  " and not isinstance(getattr(x, a), __import__('types').ModuleType)" ...
-                  " and not a.startswith('_')]"],
-                 getid (x));
+  cmd = pyeval (["lambda x: [a for a in dir(x)" ...
+                 " if not callable(getattr(x, a))" ...
+                 " and not isinstance(getattr(x, a), __import__('types').ModuleType)" ...
+                 " and not a.startswith('_')]"]);
 
   # FIXME: may need to convert from Python list to Octave cell array
-  names = pyeval (cmd);
+  names = pycall (cmd, x);
   names = names(:);
 
 endfunction