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

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Feb 20 21:13:49 CET 2011


Robert Bradshaw wrote:

> BTW, the "public" keyword is the wrong thing to use here, as that
> actually controls name mangling and (c-level) symbol exporting. The
> fact that means a different thing for members than for top-level
> symbols isn't ideal, but at least it's unambiguous as members need not
> be mangled.

The overloading of 'public' is really a bit of a mess. I've been
thinking for a while that there really ought to be a different
keyword such as "exposed" for declaring that things are to be
exposed to Python. It would be useful in lots of ways:

cdef class Foo:
   cdef exposed int i   # formerly 'public'

cdef exposed enum E:
   a, b, c              # creates Python bindings for these names

cdef exposed struct S:         # Exposed but mangled as usual
   ...

cdef public exposed struct S:  # Exposed and unmangled
   ...

-- 
Greg


More information about the cython-devel mailing list