[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Problem with simple C extension
From:       harold fellermann <harold.fellermann () upf ! edu>
Date:       2005-06-14 17:08:43
Message-ID: e3a6abd93e73446bcc366885b0519b9f () upf ! edu
[Download RAW message or body]


On 14.06.2005, at 18:58, harold fellermann wrote:

> Am I stupid or what?

Yes I was ...

> // PhysicsDPD instance structure
> typedef struct {
>    PyObject_HEAD
>    double cutoff;
>    double friction;
>    double noise;
>    double dt;
> } hyper_PhysicsDPD;
>
>
> //--------------------------------------------------------------------
> // tp_init
> //--------------------------------------------------------------------
> static int
> hyper_PhysicsDPD_init(hyper_PhysicsDPD *self, PyObject *args, PyObject
> *kwds)
> {
>    if (!PyArg_ParseTuple(args,"ffff",
> 			&self->cutoff,
> 			&self->friction,
> 			&self->noise,
> 			&self->dt
> 			))
>      return -1;
>
>    printf("%f %f %f
> %f\n",self->cutoff,self->friction,self->noise,self->dt);
>
>    return 1;
> }

format string must be "dddd" - as the members are defined as doubles,
not floats. Sorry to bother you.

- harold -

--
A country without army is like a fish without bicycle.
--

-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic