Home > Articles > Programming > Python

  • Print
  • + Share This
Like this article? We recommend Conclusion

Conclusion

Python provides an excellent vehicle for integrating legacy C++ programs into a scripted framework. The approach used in this article might be called lightweight integration (or glue logic) between these two languages. Anticipation of problems is a key requirement for successful integration, and Python provides powerful exception management.

Disciplined exception management is an extremely important skill in today's mixed-language IT landscape. Exceptions provide nearly instant feedback on problems encountered in your code. A good understanding of exception handling is an essential tool for creating robust code.

Integrating your C++ program into Python is no more difficult than using the following lines of code:

p = sp.Popen(['/home/stephen/CPlusPlus0xProject'], stdout = sp.PIPE)
result = p.communicate()[0]
print('CPlusPlus0xProject invoked'  + result + '\n')

The decision to fashion a tighter integration between Python and your codebase is difficult. Python provides many mainstream facilities, and migrating from Java to Python (for instance) is possible. However, such a massive development migration decision is not to be taken lightly.

  • + Share This
  • 🔖 Save To Your Account