Question about function parameter copy

Random832 random832 at fastmail.com
Mon Jan 18 15:15:29 EST 2016



On Mon, Jan 18, 2016, at 13:44, Robert wrote:
> cdef inline dtype_t _logsumexp(dtype_t[:] X) nogil:
> .....
> 
>           fwdlattice[t, j] = _logsumexp(work_buffer) + framelogprob[t, j]
> 
> I find that [:] is about object copy, but I am not sure about its usage
> here in a function parameter. Whether is it true that it makes a
> parameter
> copy?
> Why is it used in this way?

This is cython-specific syntax indicating that the parameter X is a
one-dimensional memory view (an array) whose elements are dtype_t. The
information you saw about object copying has to do with standard python
statements like "a_copy = a_original[:]", not examples like this one.



More information about the Python-list mailing list