Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cimporting classes and functions by just defining there names? #3134

Keithcat1 opened this issue Sep 6, 2019 · 0 comments


Copy link

commented Sep 6, 2019

This would make it a lot easier to work with classes and functions that have lots of arguments and properties.
What I'm suggesting would look something like this.
cdef class example:
cdef int a,b
cpdef get_ints(self):
return (self.a, self.b)

cdef class example

from module cimport example
cdef example x=example()

This way, the declaration is taken from one file, nothing has to be changed in two places.
What could also work is adding a new decorator, which allows cimporting of whatever it's used on.
For example:
import cython
cdef class example:
int a,b

This would allow cimporting the example class without a .pyx file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.