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

Robert Bradshaw robertwb at math.washington.edu
Wed Jan 30 09:51:02 CET 2008


On Jan 29, 2008, at 11:38 PM, Stefan Behnel wrote:

> Hi,
>
> Greg Ewing wrote:
>> Stefan Behnel wrote:
>>> 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.
>
> Not quite, if you use a keyword (or modifer), you could check at  
> compile time
> that the type does not appear in the associated .pxd, i.e. that it  
> cannot be
> cimported.

What you're saying is that you would disallow cimporting a "private"  
type? Then this might work...

While we're on the topic of visibility, what would you think about  
making any cdef function declared in a pxd file "cimportable" (i.e.  
public api, or whatever the keyword combination is--I'm never quite  
sure). This is the only reason one would put a cdef function in  
a .pxd file.

- Robert



More information about the Pyrex mailing list