Mercurial > pytave
comparison @pyobject/subsref.m @ 314:6bba42371afa
Use tuple directly in subsref, avoiding fromPythonVarName
* @pyobject/subsref.m: Replace fromPythonVarName.
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Tue, 09 Aug 2016 15:15:57 -0700 |
parents | d9f9156a13c9 |
children | 461f333daf67 |
comparison
equal
deleted
inserted
replaced
313:01ff03fef237 | 314:6bba42371afa |
---|---|
65 ind = int32 ([1:length(x)] - 1); | 65 ind = int32 ([1:length(x)] - 1); |
66 endif | 66 endif |
67 elseif (isscalar (t.subs)) | 67 elseif (isscalar (t.subs)) |
68 ind = t.subs{1}; | 68 ind = t.subs{1}; |
69 else | 69 else |
70 ## XXX: after #26, #27, I think its just: | 70 ## workaround bug: we get list of list instead of list |
71 #ind = pycall ("tuple", t.subs); | 71 # ind = pycall ("tuple", t.subs); |
72 pyexec (["global _temp\n" ... | 72 ind = pycall (pyeval ("lambda x: tuple(x[0])"), t.subs); |
73 "def pystoretemp(x):\n" ... | |
74 " global _temp\n" ... | |
75 " _temp = x"]); | |
76 pycall ("pystoretemp", t.subs); | |
77 pyexec ("_temp = tuple(_temp[0])"); | |
78 ind = pyobject.fromPythonVarName ("_temp"); | |
79 endif | 73 endif |
80 | 74 |
81 gi = pycall ("getattr", x, "__getitem__"); # x.__getitem__ | 75 gi = pycall ("getattr", x, "__getitem__"); # x.__getitem__ |
82 if (isnumeric (ind) && length (ind) > 1) | 76 if (isnumeric (ind) && length (ind) > 1) |
83 r = {}; | 77 r = {}; |