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

Stefan Behnel stefan_ml at behnel.de
Mon Feb 21 22:22:24 CET 2011

Greg Ewing, 21.02.2011 22:12:
> 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.

Hmm, I don't know. Maybe I'm just used to it already, but I don't find it 
hard to spot at all. The same argument could be brought up against "cdef" 
vs. "def" (between which the semantic difference is *huge*), and I hope you 
don't find that hard to spot.


More information about the cython-devel mailing list