It's already a feature in the python stdlib through ctypes, so it obviously
doesn't break the guidelines that much.

Also, it's not any less explicit.. it'd just be nice to create the mapping
once on the class then have the calling convention respect that everywhere
else. In many ways this is more pythonic than repeatedly typing the same
'few characters' every time  i make a function call into a C library.

As you said, this isn't really a special case, so many of us are doing it...

On Fri, Jul 24, 2009 at 12:20 PM, Lisandro Dalcin <[email protected]> wrote:

> So you are proposing to go against the Zen of Python's (Explicit is
> better than implicit) just to save a few key strokes? However, I have
> to grant you that this use case is so common (at least for all us
> using Cython for wrapping) that this idea could deserve some
> consideration? Two more lines to take into account:
>
> Special cases aren't special enough to break the rules.
> Although practicality beats purity.
>
>
> On Thu, Jul 23, 2009 at 7:17 PM, David P.
> Novakovic<[email protected]> wrote:
> > Does cython have anything like the as_parameter functionality of ctypes?
> >
> > I mean, if i have a class Foo, which wraps a struct  foo_t * foo, would
> be
> > it possible to say when i pass this object to a function the requires a
> > foo_t * parameter to pass the c level attribute of the correct type
> instead
> > of the actual python class?
> >
> > I'm writing a bunch of wrappers at the moment and it seems like there is
> a
> > lot of code that could be automated!
> >
> > Thanks... otherwise I'm really enjoying cython :)
> >
> > David
> >
> > _______________________________________________
> > 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

Reply via email to