![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
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 looked it up on the Intergnats! |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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 ![]() |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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.
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4
![]() |
There is also Boost.Python, but I just know of it; I haven't used it.
http://boost.org/libs/python/doc/index.html
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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) {
if (y == "foo")
x.slice(3,7) = "bar";
else
x.attr("items") += y(3, x);
return x;
}
object getfunc() {
return object(f);
} |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Jan 2007
Posts: 3
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
You might want to look here
|
|
|
|
|
|
#10 |
|
Sexy Programmer
|
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
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [tutorial] Python for programming beginners | coldDeath | Python | 30 | Dec 14th, 2005 11:35 AM |
| If you want to learn Python or improve your Python skills | coldDeath | Python | 2 | Nov 23rd, 2005 12:27 AM |
| Convert Python script to C++ code | clanotheduck | Python | 17 | Sep 25th, 2005 8:55 AM |
| Advanced Python Tricks | Arevos | Python | 19 | Sep 24th, 2005 7:39 AM |
| Python - A Programmers Introduction | coldDeath | Python | 17 | Aug 19th, 2005 12:41 PM |