It could be made optional..
I'm not sure about the parser rules for .pyx... but something like the
following would allow a single wrapper class to satisfy several wrapped
types. The above named param would work too, as long as people understand
where they could create attribute name conflicts.. (perhaps not as backwards
compatible)
cdef class Wrapper:
cdef foo_t * foo
_cython_type_map = { #optional
'foo_t *': foo
}
It's not really a requirement of mine to be able to map multiple types, but
if you were going to add it you might as well give people the option.
Alternatively it could just work for a single type too.
Anyway, just my thoughts :)
David
On Sat, Jul 25, 2009 at 1:21 AM, Lisandro Dalcin <[email protected]> wrote:
> On Fri, Jul 24, 2009 at 8:53 AM, Robert
> Bradshaw<[email protected]> wrote:
> > This feels a lot like C++ operator overloading...
> >
> > I'm not a fan of _as_parameter_, but maybe an "as foo_t" kind of
> > attribute that it would use every time it needed to convert it to a
> > foo_t (not just as a parameter, but in assignment, etc.) Certainly
> > something like this could be useful, but I'm not sure if it's needed.
> >
>
> Well, such feature would make mpi4py/petsc4py/slepc4py/tao4py codebase
> simpler... All my cdef classes are proxies to C handles... I'm
> constantly calling "self.handle" when calling library routines...
>
>
> > On Jul 23, 2009, at 8:29 PM, David P. Novakovic wrote:
> >
> >> http://docs.python.org/library/ctypes.html#calling-functions-with-
> >> your-own-custom-data-types
> >>
> >> I notice it only accepts basic types... and obviously the
> >> implementation would be a lot simpler than what I am talking about
> >> for cython... but that's the general gist of it.
> >>
> >> I guess for cython it would be nice to be able to have a mapping of
> >> type -> attribute (or type_name -> attribute_name) so that when the
> >> class is passed as a parameter the attribute of the right type is
> >> passed instead.
> >>
> >> David
> >>
> >> On Fri, Jul 24, 2009 at 1:23 PM, Lisandro Dalcin
> >> <[email protected]> wrote:
> >> On Thu, Jul 23, 2009 at 11:44 PM, David P.
> >> Novakovic<[email protected]> wrote:
> >> >
> >> > It's already a feature in the python stdlib through ctypes, so it
> >> obviously
> >> > doesn't break the guidelines that much.
> >> >
> >>
> >> Sorry for my ignorance about ctypes... But could you point me to some
> >> code/link or provide some more comments in order I can understand what
> >> you commented above?
> >>
> >>
> >>
> >> --
> >> Lisandro Dalcín
> >> ---------------
> >> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> >> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> >> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> >> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> >> Tel/Fax: +54-(0)342-451.1594
> >> _______________________________________________
> >> Cython-dev mailing list
> >> [email protected]
> >> http://codespeak.net/mailman/listinfo/cython-dev
> >>
> >> _______________________________________________
> >> Cython-dev mailing list
> >> [email protected]
> >> http://codespeak.net/mailman/listinfo/cython-dev
> >
> > _______________________________________________
> > Cython-dev mailing list
> > [email protected]
> > http://codespeak.net/mailman/listinfo/cython-dev
> >
>
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev