Dag Sverre Seljebotn wrote: > A decision is needed here within a few weeks; it would be great if any > core developers who don't care could respond to vote 0.
*bump* Unless I hear something, I'm going to assume that people trust my opinion here and start implementing the solution below (it's kind of a blocker for Kurt's GSoC). Speak now or forever hold your peace... Dag Sverre > > The decision was made to use [] for templates. To reiterate the main > arguments: > > - It leaves the way open for exporting pre-instantiated templates to > Python in a /very/ natural fashion. > > - Templates are a bit like a collection of types anyway. > > > However this creates some syntax issues: > > A) Currently > > cdef object[int] arr = ... > > can be used for PEP 3118 access on a generic object. While not a > technical problem (object will never become a template), it looks a bit > odd when introducing with a template feature. > > B) How would a templated buffer type look like? MyType[int][float]? > > Proposal: > > The object[int] syntax is removed (are anyone using it?). This is > basically done by making any cdef class with the > __cythonbufferdefaults__ magic attribute become a "buffer template". > Such cdef classes cannot be templates. Any other class cannot be used as > a buffer-supporting object. > > This removes functionality (much numeric code could care less about > whether the underlying object is an ndarray). As a substitute, the main > idea in http://wiki.cython.org/enhancements/buffersyntax is accepted, > which is to use > > cdef int[:] arr = ... > > for generic access, without any object access (this means that for now > only indexing and getting the shape is allowed at all.) > > I've been wondering a lot about whether this is the right way, and it > still seems so, even if it means that there will be (and likely continue > to be) two different ways of accessing a buffer; one through an explicit > "buffer type" and one through an "automatic template". > -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
