comparison @pyobject/subsasgn.m @ 365:087e7bc3697f

Do not automatically convert Python strings to Octave strings (fixes issue #65) * python_to_octave.cc (pytave::pyobj_to_octvalue): Drop conversion of bytes and unicode objects. * __py_struct_from_dict__.cc (F__py_string_value__): New function. * @pyobject/char.m: Define outside class definition, use __py_string_value__. * @pyobject/pyobject.m: Delete previous pyobject.char definition. * @pyobject/methods.m: Apply char conversion to __name__ attribute. * @py/py.m, @pyobject/cell.m, @pyobject/dummy.m, @pyobject/subsasgn.m, @pyobject/subsref.m, pyargs.m, pycall.cc, pyeval.cc: Adapt examples and tests to changes.
author Mike Miller <mtmiller@octave.org>
date Thu, 25 Aug 2016 14:06:56 -0700
parents fe6b9e618c98
children 9d7188514f2c
comparison
equal deleted inserted replaced
364:1470ed26917a 365:087e7bc3697f
90 %! % list indexing 90 %! % list indexing
91 %! L = pyeval ("[10., 20.]"); 91 %! L = pyeval ("[10., 20.]");
92 %! L{2} = "Octave"; 92 %! L{2} = "Octave";
93 %! assert (length (L) == 2) 93 %! assert (length (L) == 2)
94 %! assert (L{1}, 10) 94 %! assert (L{1}, 10)
95 %! assert (L{2}, "Octave") 95 %! assert (char (L{2}), "Octave")
96 96
97 %!test 97 %!test
98 %! % dict assignment, adding new keys 98 %! % dict assignment, adding new keys
99 %! d = pyeval ("dict()"); 99 %! d = pyeval ("dict()");
100 %! d{"a"} = 3; 100 %! d{"a"} = 3;