First page Back Continue Last page Overview Graphics

Solution

%module persons

%inline %{

struct Person {

char *firstname;

char *surname;

float height;

};

%}

>>> from persons import Person

>>> x = Person()

>>> from persons import Person

>>> x = Person()

>>> x.firstname = "Marc"

>>> x.firstname = 3

Traceback (most recent call last):

...

TypeError: in method 'Person_firstname_set', argument 2 of type 'char *'

>>> x.surname = "Steiner"

>>> x.height = 176.9