[Cython] [cython-users] Cython .pxd introspection: listing defined constants
Stefan Behnel
stefan_ml at behnel.de
Sat Feb 26 08:59:38 CET 2011
W. Trevor King, 22.02.2011 21:02:
> On Tue, Feb 22, 2011 at 08:18:21PM +0100, Stefan Behnel wrote:
>> I also doubt that Cython allows you to call an attribute "cdef", you'll
>> need to change that.
>
> It seems to work for me:
> >>> import Cython.Compiler.Parsing as P
> >>> P.__file__
> 'Cython/Compiler/Parsing.so'
> >>> c = P.CSource()
> >>> dir(c)
> [..., 'cdef', 'deepcopy', 'extern', 'name', 'namespace']
> >>> c.cdef
> 0
> >>> c.cdef = 1
> >>> c.cdef
> 1
Ah, right. It's actually compiled as .py file, so Cython's syntax doesn't
apply here. However, it may apply to other parts of the compiler at some
point, so it's better not to use keywords in parts of the source that
become globally visible.
Stefan
More information about the cython-devel
mailing list