Brian Granger wrote:
> Dag,
>
> I quickly glanced through the proposal and have two big picture questions:
>
> * What will this make possible that is currently not possible?

1) Efficient slices

2) Leave the road open for memory bus friendlier arithmetic (re: Hoyt
Koepke's project proposal)

3) Automatic contiguous copies in/out if a function is coded to work on
contiguous memory

Why can't this be done currently?

 * Cython contains no in-compiler support for NumPy, and so cannot know
how to create new underlying ndarray objects.

 * All optimizations need to hard-code semantics at compile-time. With
single-element indexing it seemed fair to assume the usual semantics of
zero-based indexing etc., but with slices tings get worse (which kind of
object is returned) and with arithmetic downright impossible (what does *
do again?)

That's not to say there's not other options:
1) We could hard-code support for NumPy only, and only allow ndarray and
not subclasses thereof.

2) We could invent some new protocol/syntax for defining compile-time
semantics for all relevant operations.

> * What will this make easier that is currently really difficult?

Well, nothing is really difficult. But passing, say, a PIL image into C
code and back again for processing (with, say, a contiguous C array) isn't
completely straightforward, but would be with this proposal.

Dag Sverre




_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to