![]() |
Coding in Python or C++
If you would know Python and C++ equally well, what kind of programs would you use each of these languages for?
Why would C++ be preferred over Python? |
I'd use C++ when Python isn't fast enough to accomplish what I want to do. Or if C++ has a vital library I need and Python doesn't.
So efficiency and libraries, really. Not that Python's particularly lacking for libraries :) |
You will definitely find Python inferior to C++ when it comes to performance (I do find Pyton to be superior to PHP in that respect). That doesn't mean I'm not using the hell out of Python -- I am. Here's an example: generating my set of basic tic-tac-toe patterns takes a few seconds in Python. It takes so long in PHP that one can't write it as a server function because the script times out. In C++, the time is humanly indistinguishable from instantaneous.
|
Incidentally, tools like SWIG and Pyrex make integrating C++ with Python require very little effort indeed. Pyrex uses a Python-like syntax that translates directly into C, whilst SWIG automatically turns standard C functions into ones compatable with the Python C++ API. Psyco is also worth looking into as a way to speed up Python code.
|
I'll look into Swig and Pyrex, as I've been thinking about dinking with the C API. Psyco is indeed very useful, though not bullet-proof.
|
There is also Boost.Python, but I just know of it; I haven't used it.
http://boost.org/libs/python/doc/index.html |
I have played around with Boost.Python it provides a very nice python interface and wrapping system. Combined with Py++ you can even get SWIG like wrapper generation. The only downside is of course the compile time which will can get a little long due to the heavy use of templates. But you have to admit being able to do this is pretty cool:
:
object f(object x, object y) { |
I want to learn how to program and people say prthon is the easy to learn out of all programming language. can anyone tell me the easiest to learn just so i can get a feel for programming and can anyone suggest any books or free tutorial websites to recommend. Greatly appreciated for any recommendations or insight in the subject.
|
You might want to look here
|
I like how you just hijack this thread. Why not create your own?!
And For your quesrion, I would look into this FREE ebook. It is a beginner's level intro to programming book on Python. It very good and easy to read. http://greenteapress.com/thinkpython/thinkCSpy.pdf |
| All times are GMT -5. The time now is 11:19 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC