On Jul 30, 2008, at 11:17 AM, Nicole King wrote:

> Dear Stefan,
>
> Thank you for your reply.
>
> Your suggestion seems quite reasonable. I had, indeed, tried it  
> before. It causes a different message
> that should, to someone with more wits than I, suggest the origin  
> of my problem. I'm still baffled.
>
> [EMAIL PROTECTED]:4:~/firewall $cython libiptc.pyx
>
> Error converting Pyrex file to C:
> ------------------------------------------------------------
> ...
>   void finish(opaque_pointer** h)
>
> cdef class a_class:
>   cdef opaque_pointer* the_handle
>   def __init__(table_name):
>     self.the_handle = init(table_name)
>        ^
> ------------------------------------------------------------
>
> /home/nicole/firewall/libiptc.pyx:10:8: undeclared name not  
> builtin: self
> [EMAIL PROTECTED]:4:~/firewall $

Unlike some languages, Python requires that the "self" parameter be  
explicitly named everywhere, including in the method arguments. Thus  
one would have to write

cdef class a_class:
   cdef opaque_pointer* the_handle
   def __init__(self, table_name):
     self.the_handle = init(table_name)


> I'm wondering if I should abandon the idea of using Cython/Pyrex.

I hope Cython works for you. If you don't know Python yet it will  
probably be a bit of a steeper learning curve than otherwise, but  
sure beats writing everything by hand.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to