Re: Learning C++ for Python Development
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 joshua.pea...@gmail.com wrote: Or, just give me some general advice on learning C++ for Python? You may want to start with Cython first. It lets you intersperse C and C level information with Python code to produce extensions. That will give you a gentler introduction to using a C like language with Python and for many real world uses is actually sufficient to get C levels of performance and interfacing with Python. After you get that working then you can try coding your own extensions (the Python docs include all the necessary information) and also trying other tools such as SWIG which automate some of the code for wrapping C++, or the wrapping functionality present in Boost. I find it most helpful to explore doing the same thing in multiple different ways as it teaches you what is important and what isn't. Later on it will help you a lot better in choosing the right tool for the job (no one tool or approach is perfect) and help evaluate anything that comes up later. My suggestion would be to pick a particular task and code it in pure Python. Benchmark it (cpu and memory) and then try the other approaches (Cython, Boost, hand coded, SWIG) and see how they compare. Something like a brute force Suduko solver would let you have a few classes/objects but not be too much code. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkoHy/QACgkQmOOfHg372QTxywCgrJPcHLQ5BzD8O29nSAW+I5xo juYAnjMP0xqn/TzC5mrTCqBT3ZnIQo24 =KeIk -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning C++ for Python Development
joshua.pea...@gmail.com joshua.pea...@gmail.com wrote: I am a recovering C# web developer who has recently picked up Django and I'm loving it. I would eventually like to get a job as a Django/Python developer. It seems that many Python jobs require that you also be a C++ developer. While I want to remain primarily a web developer, I don't want be stuck doing CRUD applications, so I would like to learn C++ for Python development. I have taken two basic programming courses in straight up C++, no STL, Boost or anything like that, but I do have a very basic knowledge of the language. Can you folks suggest some Python packages which use C++ and are relevant for web development, so I can dig through the source and contribute in some way? Or, just give me some general advice on learning C++ for Python? I'm guessing that people who advertise for C++ and Python are embedding python into C++ not extending python with C++. Having done both things, I can say that embedding python into C++ is not too much trouble, but that it is slightly easier to extend python with C rather than C++ since the python executable is a C program not a C++ program. I'd start by reading this http://docs.python.org/extending/ And try some of the examples. I'd also read all about ctypes http://docs.python.org/library/ctypes.html Which has saved me a huge amount of time in both the embedding and extending cases! One of the apps I've worked on is C++ but can have drivers written in python run by an embedded python interpreter. These drivers can call back into the C++ code, and the C++ can call into the drivers. That is done with a amount of C++ to load the drivers and to export the C++ symbols into the python code at runtime with ctypes. A bit of C++ implements the shims for the callbacks from python - C++ (which are exported by ctypes). P.S. I want to develop on Linux not Windows. Should be just the same on both. Once you've made your setup.py (for extending python) the build process will work on all supported architectures. -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning C++ for Python Development
joshua.pea...@gmail.com wrote: I am a recovering C# web developer who has recently picked up Django and I'm loving it. I would eventually like to get a job as a Django/Python developer. It seems that many Python jobs require that you also be a C++ developer. I've seen the C++/Python combination in job descriptions, too. ISTM that these are about systems that are written in C++ and then scripted in Python. For speeding up Python applications. While I want to remain primarily a web developer, I don't want be stuck doing CRUD applications, so I would like to learn C++ for Python development. In the web development field, the probability for doing custom C/C++ development is very low in my experience. I have taken two basic programming courses in straight up C++, no STL, Boost or anything like that, but I do have a very basic knowledge of the language. Learning progamming languages never hurts, but I'd recommend you learn C instead, perhaps by using the Python C API (writing small extension modules). There are not so many Python extensions written in C++, most are written in C. C++ usually doesn't buy you enough to warrant using it instead of C here. So my advice: go with C. Or learn something more relevant to web programming. Like improve your JavaScript skills ;-) [...] -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Learning C++ for Python Development
I am a recovering C# web developer who has recently picked up Django and I'm loving it. I would eventually like to get a job as a Django/Python developer. It seems that many Python jobs require that you also be a C++ developer. While I want to remain primarily a web developer, I don't want be stuck doing CRUD applications, so I would like to learn C++ for Python development. I have taken two basic programming courses in straight up C++, no STL, Boost or anything like that, but I do have a very basic knowledge of the language. Can you folks suggest some Python packages which use C++ and are relevant for web development, so I can dig through the source and contribute in some way? Or, just give me some general advice on learning C++ for Python? P.S. I want to develop on Linux not Windows. Thanks! -- http://mail.python.org/mailman/listinfo/python-list