cython/cython

Coercing a sliced C array to Python should create a list

Ouverte

#2 159 ouverte le 17 mars 2018

 (3 commentaires) (0 réaction) (0 personne assignée)Python (1 517 forks)batch import
Cython Language FeatureType Analysisenhancementgood first issuehelp wanted

Métriques du dépôt

Stars
 (8 663 étoiles)
Métriques de merge PR
 (Merge moyen 45j 12h) (52 PRs mergées en 30 j)

Description

Cython already copies a C array into a Python list automatically on object coercion. It should do the same for sliced C arrays, e.g.

def test():
    cdef int i
    cdef int a[100]
    for i in range(100):
        a[i] = i**2
    return a[:20]  # rejected by type analysis

Currently results in Cannot convert 'int *' to Python object.

Guide contributeur