[Numpy-discussion] searchsorted bug

Travis E. Oliphant oliphant@enthought....
Thu Jan 31 12:53:42 CST 2008


James Philbin wrote:
> I can't fathom where the comparison functions exist in the code. It
> seems that the comparison signature is of the form (void*, void*,
> PyArrayObject*), so it doesn't seem possible at the moment to specify
> a compare function which can reason about the underlying types of the
> two void*'s. However, I think arrays of strings are a common enough
> use case that they should work as expected - would it be possible to
> extend the comparison type to accept two integers specifying the types
> of the arguments?
>   

The problem is due to the use of an older API in type conversion.   I 
think I can provide a fix in a few minutes. 

The compare function is type-specific and works for strings but requires 
the same length string for each argument.   It is defined as part of the 
PyArray_Descr object (defined in arraytypes.inc.src).

It may be possible to not require contiguous arrays, but that is a 
separate issue.

-Travis O.





More information about the Numpy-discussion mailing list