Winzer
- 597
- 0
I am learning Python right now and it is pretty cool. Just out of curiosity, would it be a easy transition to learn C++ after I master Python?
The discussion revolves around the transition from learning Python to C++, particularly in the context of computational software and libraries used in fields like computational fluid dynamics (CFD). Participants explore the advantages and challenges of using C++ alongside Python, as well as tools for interfacing the two languages.
Participants express a mix of opinions regarding the transition from Python to C++, the effectiveness of various interfacing tools, and the best practices for using these languages in computational contexts. No consensus is reached on the superiority of one tool over another or the best approach to learning C++ after Python.
Some discussions highlight limitations in the capabilities of Boost::Python and SWIG, as well as the challenges of using C++ with Python, particularly for beginners. The conversation reflects varying levels of experience and familiarity with programming concepts and tools.
mgb_phys said:Thanks for the book pointer,
I have Langtangen and agree it's excellent. I'd disagree w/ the recommendation of Swig now, especially for those starting out. Ctypes IMO has eclipsed it as the best bet: far easier to use, learn, and debug, comes builtin w/ Python, and for some things out performs Swig substantially. Downside is Ctypes won't handle C++shoehorn said:For what little it's worth, I've often found Boost::Python to be perhaps the most severely lacking component in the Boost libraries. (The reasons are technical and I won't discuss them here.)
On the other hand, Swig is a great way of wrapping C/C++ code so that it can be used with Python (among many other languages). It's discussed in several places but a really useful introduction to it, as well as to the use of Python more generally in a scientific context, is Langtangen's https://www.amazon.com/dp/3540739157/?tag=pfamazon01-20. (Langtangen's book is wonderful for many reasons but it also does a really good job of illustrating how Python can be used to interface with Fortran and C/C++ code, something that's essential knowledge if you're going to be working with scientific libraries.)