Re: Returning proper booleans from python to gnumeric 1.0.12

On Wed, Oct 29, 2003 at 03:04:20AM -0800, Anthony D. Urso wrote:
I have this function in my for gnumeric:

def func_iff(context, a, b):
    if a == b:
        return True
    return False

Unfortunately, returning True actually returns 1, and returning "TRUE"
actually returns "'TRUE".

Is there any method of returning actual gnumeric booleans from the python

My quick reading of the 1.0.12 python-loader code is that it
supports this.

Value *
convert_python_to_gnumeric_value (const EvalPos *eval_pos, PyObject *py_val)
        } else if (py_val_type == (PyObject *) &py_Boolean_object_type) {
                ret_val = value_new_bool (py_Boolean_as_gboolean ((py_Boolean_object *) py_val));

but then again I didn't try it and have not run 1.0.x in almost a
year.  You may want to update to the 1.2.x series and see if the
problem persists.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]