[Cython] [cython-users] Cython .pxd introspection: listing defined constants

W. Trevor King wking at drexel.edu
Thu Feb 17 14:44:24 CET 2011


On Thu, Feb 17, 2011 at 08:29:41AM -0500, W. Trevor King wrote:
>     cpdef struct Foo:
>         cpdef public int intA
>         cpdef readonly int intB
>         cdef void *ptr

Oops, for consistency with classes, the variables declarations should
read `cdef public` and and `cdef readonly`.  Perhaps `cdef struct`
too, to match `cdef class`?

I get a bit confused, because for some things (functions, methods)
`cpdef` adds a Python interface.  For others (attributes) it's `cdef
public/readonly`.  There are even some things (classes), where a plain
`cdef` is enough to provide a Python interface.  Perhaps I am just
missing some subtle distinction between the effects of the various
incantations?

-- 
This email may be signed or encrypted with GPG (http://www.gnupg.org).
The GPG signature (if present) will be attached as 'signature.asc'.
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

My public key is at http://www.physics.drexel.edu/~wking/pubkey.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20110217/34ec21e3/attachment-0001.pgp>


More information about the cython-devel mailing list