Realistically, the old [] syntax is here for the next Cython release so 
I might move on to fix that bug...

But here's an idea for a syntax I actually like (let's hear about you)...:

Somehow specify that the variable in question has TWO types. I.e., it 
supports the ndarray interface, as well as the buffer interface.

So, for buffers this would becom

cdef ndarray,buffer(int, 2) buf = ... # ndarray supporting buffer

cdef buffer(int, 2) buf = ... # plain object supporting buffer
cdef object,buffer(int, 2) buf = ... # same as above

If it is possible with objects that inherit from two extension types 
(didn't try it) this could even be used like this:

cdef MyType1,MyType2 obj = ...

This would make the syntax "explain" what happens today anyway, with 
"cdef MyType1 obj" being shorthand for "cdef object,MyType1 obj". I.e. 
"first try to resolve compile-time towards MyType1, and then towards 
object".

*running away and ducking* :-)

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to