[Cython] about numpy, c/python namespaces and name clashes, and some tricks ; -)
Robert Bradshaw
robertwb at math.washington.edu
Thu May 15 11:22:24 CEST 2008
On May 15, 2008, at 2:20 AM, Dag Sverre Seljebotn wrote:
>> cdef FsAsObj d = FsAsObj()
>> d = d.usr.include
>> call_native_c_function(d.fshandle)
>>
>> Then I do
>>
>> $ sudo mkdir /fshandle
>
> No, actually you're right. With the addition of your type behaviour
> suggestions one could do
>
> cdef FsAsObj mydir = d.fshandle # gets "/fshandle"
> cdef int myhandle = d.fshandle # gets underlying file handle
>
> which, when I look harder at it, isn't all that horrible. "Attribute
> access overloading"...
>
> Perhaps such type-dependant behaviour would be a default mode; while
> features could be added like (when needed/if worth it/if I get time):
>
> cdef cython.python_interface(FsAsObj) mydir...
> cdef cython.c_interface(FsAsObj) mydir...
>
> as additional access-modes for purists and contrived examples.
Well, (<object>foo) is always the Python interface, so we've already
got that covered in case one really wants it.
> (Heh, promising to shut up is a promise that's hard to keep..)
For me too :).
- Robert
More information about the Cython-dev
mailing list