Mercurial > pytave
diff @pyobject/subsasgn.m @ 312:d9f9156a13c9
Remove unncessary calls to fromPythonVarName
* @pyobject/subsasgn.m: Drop fromPythonVarName
* @pyobject/subsref.m: Drop fromPythonVarName
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Tue, 09 Aug 2016 11:08:58 -0700 |
parents | 2cb6e2824776 |
children | 6f03249847fa |
line wrap: on
line diff
--- a/@pyobject/subsasgn.m Tue Aug 09 15:40:52 2016 -0700 +++ b/@pyobject/subsasgn.m Tue Aug 09 11:08:58 2016 -0700 @@ -88,8 +88,7 @@ %!test %! % list indexing -%! pyexec ("L = [10, 20]") -%! L = pyobject.fromPythonVarName ("L"); +%! L = pyeval ("[10, 20]"); %! L{2} = "Octave"; %! assert (length (L) == 2) %! assert (L{1}, 10) @@ -97,8 +96,7 @@ %!test %! % dict assignment, adding new keys -%! pyexec ("d = dict()") -%! d = pyobject.fromPythonVarName ("d"); +%! d = pyeval ("dict()"); %! d{"a"} = 3; %! d{"b"} = 4; %! assert (d{"a"}, 3) @@ -106,15 +104,13 @@ %!test %! % dict assignment, update existing key -%! pyexec ("d = {'a':1}") -%! d = pyobject.fromPythonVarName ("d"); +%! d = pyeval ("{'a':1}"); %! d{"a"} = 3; %! assert (d{"a"}, 3) %!test %! % dict assignment, other keys (e.g., Issue #10). -%! pyexec ("d = dict()") -%! d = pyobject.fromPythonVarName ("d"); +%! d = pyeval ("dict()"); %! d{"5"} = 10; %! d{5.5} = 11; %! d{5} = 12;