[Cython] [cython-users] Cython .pxd introspection: listing defined constants
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Feb 21 22:12:52 CET 2011
Stefan Behnel wrote:
> With "preferred way", I was suggesting that we could *deprecate*
>
> cdef public int x
> cdef readonly object y
>
> for cdef class properties in favour of
>
> cpdef int x
> cpdef readonly object y
I think I've just realised one of the reasons for my gut
dislike of the "cpdef" keyword -- it looks too similar to
"def". At first glance, it's hard to spot the difference
between the cdef and cpdef versions of two otherwise
identical declarations.
I think this is too subtle for something that makes such
a big difference to semantics. It's often important that
Python code is not allowed to mess with an object's
internal state, so making it possible should require
something more obvious.
--
Greg
More information about the cython-devel
mailing list