[Pyrex] [Cython-dev] cdef private class ... ?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jan 29 23:15:49 CET 2008


Stefan Behnel wrote:
> I just find it a bit of a bad design that 'cdef' changes the visibility in the
> first case but not in the second.

But 'cdef' doesn't mean 'invisible to Python', it means
'implemented in C' (or in the case of functions, 'uses
C calling conventions'). Invisibility to Python is just
a consequence of the fact that some C things have no
equivalent in the Python world.

Extension types are something of a special case, because
they exist simultaneously in both the C world and the
Python world. Maybe 'cdef' wasn't the best thing to use
for them, but I didn't want to introduce any more keywords
than necessary, and it makes sense when you think of it
as meaning 'implemented in C'.

> I would really like to have something like this.

The main thing that worries me is the cimport issue --
if you remove the module dict entry, then other Pyrex
modules (and any other C-implemented modules, for that
matter) are prevented from accessing the type as well.
This applies regardless of whether it's done by a keyword
or by del.

--
Greg



More information about the Pyrex mailing list