FAQ
Hey,

Currently when we want to convert C arrays to memoryview slices we have to
do this:

cdef int array[5][4]
cdef int[:, :] slice = <int[:5, :4]> <int *> array

I'd like to be able to write

cdef int array[5][4]
cdef int[:, :] slice

slice = <int[:, :]> array
# and
slice = array

I think that would be convenient, especially if we later on support
variable sized C arrays. I also changed semantics with the cython.array
callback, so now the data gets deallocated only if cython.array allocated
it itself, otherwise a callback may be registered.

Anyone opposed to the above semantics?

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20111123/42213f88/attachment.html>

Search Discussions

  • Robert Bradshaw at Nov 23, 2011 at 9:46 pm

    On Wed, Nov 23, 2011 at 12:21 PM, mark florisson wrote:
    Hey,

    Currently when we want to convert C arrays to memoryview slices we have to
    do this:

    cdef int array[5][4]
    cdef int[:, :] slice = <int[:5, :4]> <int *> array
    I'd like to be able to write
    cdef int array[5][4]
    cdef int[:, :] slice
    slice = <int[:, :]> array
    # and
    slice = array
    I think that would be convenient, especially if we later on support variable
    sized C arrays. I also changed semantics with the cython.array callback, so
    now the data gets deallocated only if cython.array allocated it itself,
    otherwise a callback may be registered.
    Anyone opposed to the above semantics?
    Sounds good to me. Having to explicitly set the deallocate callback
    seems the better default. Did you update the docs?

    - Robert
  • Mark florisson at Nov 23, 2011 at 9:58 pm
    Yes, but I'm running some tests on hudson.
    On 23 November 2011 21:46, Robert Bradshaw wrote:

    On Wed, Nov 23, 2011 at 12:21 PM, mark florisson
    wrote:
    Hey,

    Currently when we want to convert C arrays to memoryview slices we have to
    do this:

    cdef int array[5][4]
    cdef int[:, :] slice = <int[:5, :4]> <int *> array
    I'd like to be able to write
    cdef int array[5][4]
    cdef int[:, :] slice
    slice = <int[:, :]> array
    # and
    slice = array
    I think that would be convenient, especially if we later on support variable
    sized C arrays. I also changed semantics with the cython.array callback, so
    now the data gets deallocated only if cython.array allocated it itself,
    otherwise a callback may be registered.
    Anyone opposed to the above semantics?
    Sounds good to me. Having to explicitly set the deallocate callback
    seems the better default. Did you update the docs?

    - Robert
    _______________________________________________
    cython-devel mailing list
    cython-devel at python.org
    http://mail.python.org/mailman/listinfo/cython-devel
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/cython-devel/attachments/20111123/da66ddad/attachment.html>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcython-devel @
categoriespython
postedNov 23, '11 at 8:21p
activeNov 23, '11 at 9:58p
posts3
users2
websitecython.org

2 users in discussion

Mark florisson: 2 posts Robert Bradshaw: 1 post

People

Translate

site design / logo © 2017 Grokbase