[SciPy-user] changes of weave in current cvs version?

CL WU anewgene at hotpop.com
Fri Oct 17 16:44:14 EDT 2003


Hi, Group,
               I installed cvs version of scipy, but I can not make 
dictionary sort code in weave document work. def c_sort(adict):

|/==================================================================
        assert(type(adict) == type({}))
        code = """     
        #line 21 "dict_sort.py"  
        Py::List keys = adict.keys();
        Py::List items(keys.length()); keys.sort();     
        PyObject* item = NULL; 
        for(int i = 0;  i < keys.length();i++)
        {
            item = PyList_GET_ITEM(keys.ptr(),i);
            item = PyDict_GetItem(adict.ptr(),item);
            Py_XINCREF(item);
            PyList_SetItem(items.ptr(),i,item);              
        }           
        return_val = Py::new_reference_to(items);
        """   
        return inline_tools.inline(code,['adict'],verbose=1)
==================================================================
I guess it is because weave is updated while document not. I did some modification of the code, 
such as, "Py" --> "py"; list reference using "[]". It solved some errors, but still I cannot figure 
out how to access items from a dictionary. Help needed. Thanks in advance.

Chunlei
/|





More information about the SciPy-User mailing list