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

Stefan Behnel stefan_ml at behnel.de
Sun Feb 20 22:17:58 CET 2011


Greg Ewing, 20.02.2011 21:13:
> 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
> ...

Given that Cython has "cpdef" already, why not just use that?

Stefan



More information about the cython-devel mailing list