Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add include_once statement. #3057
Currently we cannot control if a file has already been included with the
Hmm, the barrier for adding a new keyword to the language is fairly high. In fact, we are trying to get away from special syntax, not add to it. What if users had a line like this in their code:
Could you explain a bit more what your use case is? It's easier to understand what you want when you explain why you want it. An example would help.
We have multiple products that all share some common code base.
Here is what our project looks like:
The issue is that
So when cythonizing and compiling
I can make it work by removing
Another solution would be to use a header guard with a compile variable:
And to replace
The issue with this solution is that we need
To solve this issue we need to find a way to detect if
I see two solutions:
True. OTOH, Cython will give you a compile time error if you test the value and it's not defined, so these cases are safe and easy to detect. I would suggest defining the variable at the top of your main module file. I think I would also lean towards testing it inside of the included file rather than in all files that include it.