--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I know about the extension class. The problem is that I don't want to use pyx files, because then I would be facing the problems that I cannot directly use and execute the code with the Python interpreter. If I would use pyx files I would have to either always compile the pyx file to a pyd file before I can test and use the code or I would have to manage 2 files (py + pyx files). The combination of py and pxd files is for me the best because I can develop the code in pure Python and I can use it directly without the need to converting it into a pyd-file in every other project. With the pxd-file I can speedup the code. This solution is perfect. But unfortunately the pxd-files have several limitations. One of them ist that I cannot use __cinit__. If I use it in the py-file but not defining it in the pxd-file as a C-function, it is handled by Cython as a pure Python function. And in the pxd-file I'm not able to define it as a C-function. Cython does not allow to define special functions, like __init__ and __cinit__, in the pxd-files. So the solution I've posted in my second post is a more or less bad compromise solution.
I know about the extension class. The problem is that I don't want to use pyx files, because then I would be facing the problems that I cannot directly use and execute the code with the Python interpreter.
I have no idea how complex it is implementing this feature in Cython, but it would be really great.
Regards, Martin
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
so you want pure python mode. I haven't used that, but I'm pretty sure you can do most of the same stuff.
Another problem I'm facing with Cython is that it cannot handle static member variables like Python does (see my first post). In Python I can define a class A with member variable B, initialized with value 1. I simply can access it with A.B. Unfortunately Cython cannot handle this, but I would need this in several projects.this doesn't work in Cython???class A(object):b = 1c = 2def __init__(self, .....):passa = A()print a.b, a.cWhy not?
Or is that you can't figure out how to declare that A.b and A.c are particular static types?in which case, try:class A(object):
b = cython.declare(cython.int, 1)c = cython.declare(cython.int, 2)def __init__(self, .....):
pass
a = A()
print a.b, a.c
this doesn't work in Cython???class A(object):b = 1c = 2def __init__(self, .....):passa = A()print a.b, a.c
Compiling the created cpp-file with cython from the above example fails, because b and c are created as module global variables "b" and "c". So accessing "b" with "a.b" or "A.b" will fail with an "unknown identifier" error.
As I mentioned in my above posts static member variables are not handled correctly in cython. I'm not sure if this is a bug, or a just not implemented feature.
./setup.py build_ext --inplace
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.