Sebastien Binet wrote:
> hi there,
>
> I am in the process of applying what I learnt at last SciPy'08 tutorial (yes, 
> I am that slow) on an almost-real-life project of mine.
> Up to now I am trying to translate an old C++/PyCxx project (which does not 
> compile anymore) into Cython: so far so good.
>
> One thing, though: the separation of '.pyx' and '.pxd' files to export 
> declarations is a bit too C-ish.
>
> Couldn't the same functionality be achieved by re-using the __all__ module 
> attribute ?
>
> ## mymodule.pyx ##
> __all__ = ( 'Foo', 'bar')
>
> cdef class Foo:
>    # implementation elided
>
> cdef int bar():
>   return 42
> ## EOF ##
>
> ## test.pyx ##
> cimport mymodule
> print "bar:",mymodule.bar()
> ## EOF ##
>
> I suppose I am missing some implementation detail, but from my 20k feet 
> overview, it seems that should work :)
>   
I remember that the basic idea of this feature (which would be 
implemented as "generate pxd files automatically from pyx files") has 
been discussed earlier (Sage dev 1 days?) and it's definitely on our 
would-like-to-do-if-we-get-time list :-) The idea about using the 
__all__ attribute to declare what symbols to export was new; I like it!

Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to