0

How can I get syntax highlighting and debugging capabilities for C code that is inlined into a Python script? The tutorials on Weave put the to-be-inlined C code into a string constant, which seemingly makes the convenience that I am talking about impossible. However, I cannot imagine that the SciPy users are stuck without any handy tools... Thanks!

AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
  • For the syntax highlighting part, you could write the C code in another file and load it in the python string afterwards. See [this](http://stackoverflow.com/questions/8369219/how-do-i-read-a-text-file-into-a-string-variable-in-python) – gg349 Mar 21 '14 at 10:19
  • I would have to suffer two overheads then: the I/O overhead and the overhead of a function call (syntax highlighting and tabulation would not work unless I enclose the code in the separate file into a function...). However, the more important issue is that this approach does not solve the debugging part of the question. – AlwaysLearning Mar 21 '14 at 11:23
  • 2
    That overhead should be negligible considering that you have to compile the C code anyway, which should outweigh the overhead mentioned. – David Zwicker Mar 21 '14 at 12:48
  • The compilation is done once, while I/O is done each time unless special care is taken and the function call is done each time for sure. But in any case, I could put the C code back into the string constant once I know it works. Debugging is the main issue here... Is there anything I can do for debugging that C code besides running it in my head? – AlwaysLearning Mar 21 '14 at 14:06

0 Answers0