[Tutor] C++ or Python?

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 3 13:58:51 EDT 2018


On 03/07/18 14:48, Bellamy Baron wrote:

> I have heard C++ is faster than python and I have a few questions
> 1.Is there a way to make python run just as fast

Kind of. Nearly. But its limited to specific types of program.
The most common approach is to identify the slow bits and rewrite
them in C++ then expose that code to python as a library. You
then call the C++ code from your Python program. That's how
most of the core libraries are written. Most programs only
need C++ speed for a tiny part of their functionality.

Python is about speed of development not speed of execution.
For most programming tasks modern computers mean that Python
is fast enough. But games (or certain types of games) are one
of the exceptions to that generalisation.

> 2.can I get in a serious game making team like 343 by using python

No idea, never even heard of them.
But in general games programmers tend to favour C++.

> 3. if C++ is better where can I get good 3d model libraries and libraries
> that make coding in C++ faster

You'd need to ask C++ programmers, and probably more
specifically other games programmers. Gamers have very unique
programming needs which is why many universities teach
games programming as a separate course. The graphics
libraries they use are likely to be different from the
ones used by, for example, Adobe to create Photoshop...

> 4. Is there a way to transfer python files to C++

If you mean convert then no, not directly.
But projects like Cython allow you to write Python-like
code that turns into C code eventually. Its very clever
but not likely what you are looking for.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list