[Cython] cimport from __all__
Sebastien Binet
seb.binet at gmail.com
Mon Jun 1 18:11:50 CEST 2009
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 :)
cheers,
sebastien.
--
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################
More information about the Cython-dev
mailing list