comparison pycall.cc @ 368:4d54fb68de71

__py_is_none__: new compiled function to test whether an object is None * __py_struct_from_dict__.cc (F__py_is_none__): New function. * @py/subsref.m, @pyobject/subsref.m, pycall.cc: Use __py_is_none__ instead of ad hoc lambda expression.
author Mike Miller <mtmiller@octave.org>
date Thu, 25 Aug 2016 16:27:46 -0700
parents 087e7bc3697f
children 55cd61fe519a
comparison
equal deleted inserted replaced
367:9d7188514f2c 368:4d54fb68de71
276 276
277 ## None as a return value 277 ## None as a return value
278 %!test 278 %!test
279 %! f = pyeval ("lambda: None"); 279 %! f = pyeval ("lambda: None");
280 %! r = pycall (f); 280 %! r = pycall (f);
281 %! is_none = pyeval ("lambda x: x is None"); 281 %! assert (__py_is_none__ (r))
282 %! assert (is_none (r))
283 282
284 ## But returning None will not set "ans" 283 ## But returning None will not set "ans"
285 %!test 284 %!test
286 %! f = pyeval ("lambda: None"); 285 %! f = pyeval ("lambda: None");
287 %! clear ans 286 %! clear ans