Is Python underestimated with what it can do?

Started by
32 comments, last by jpetrie 10 years, 8 months ago


I think it's hard to work with on projects of scale.

I agree with most of what you've said, except for this statement. Although I don't know understand exactly what you mean by "projects of scale", I'm going to guess that you mean "large projects". Feel free to correct me if that is not what you meant. If it is what you meant, this is simply not true. OpenStack, for example, is written in Python: http://www.openstack.org/. I would consider this to be a large project, anyway.

As a side note: Python is great for scripts, one-off tools, and quick-and-dirty prototypes, but anyone who says that's the _only_ thing that it's good for has probably never written a significant application with it. (Source: In my day job I develop on an open-source seismic hazard assessment engine, which can run regional and global scale calculations and is entirely written in Python. See http://openquake.org/.)

Advertisement

Some general comments about "speed". Disclaimer: I code (mostly) in Python as a full time job.

First of all, performance isn't just about language choice, but also algorithm choice. An inefficient program written in a "fast" language is still inefficient. So I don't think it makes sense to just label a language as "slow". As others in the thread have said already, sometimes just "fast enough" is sufficient.

Second, you have to take into account speed of _development time_. I realize that this is more of an economic measure, and that most everyone in the thread so far has been focused on speed of _performance_, but do not underestimate the value of this. If the need for development speed is greater than the need for sheer performance, a higher-level language, if it is just "fast enough", is a good choice.

Third, and this is a comment specifically about Python, many of the standard and third-party libraries available have parts of them written in C, thus they can be quite performant. This is a really nice feature in my opinion. The combination of high-level interfaces and the option to write extensions in C to address your worst computation bottlenecks is a pretty good combination and makes Python a good choice for a wide variety of applications.

All languages seem to get degraded, lets just call it language insecurity or e-religion, I mean if you compare the language comparison threads with theological comparisons you would actually be quite amused on how similar they are, which would probably explain why some people are obsessed with defending their language of choice while criticising others and religiously sticking with it lol.

The important thing is that you are learning / increasing your knowledge, it doesn't matter if its C, Python, C++, C# or even assembly, the more you practice the better you get (providing ofc you are actively learning and not just assuming stuff in other words making mistakes) and the closer you will get to your compiler God.

Totally agree with this. I think that instead of discussing "what makes language X is better than language Y, Z, etc.", I think it's more worthwhile to discuss "what makes language X good", period. Otherwise, it's just religion, complete with witch hunts and stoning. =P


You seem to be missing the fact that Python is already a hugely popular and successful programming language:
EVE online (among other games), is written largely in Python.
A good chunk of Google's infrastructure is written in Python.
Python is the scripting language of choice for content creation packages like Maya.
TIOBE ranks Python as the world's 8th most popular programming language.
And so on...

A few more specific examples of "popular" applications that I know of:

- OpenStack

- Blender (for scripting, not the application itself)

- The backend for yelp.com

We use Python for our build server and it works great, as for games, it is certainly a powerful scripting language but we prefer lighter alternatives such as using native C++ (which the rest of the game is written in anyway) for (compiled) game scripts. Less effort needed for writing binding layers and there are very little speed issues ;)

One great example of where python was used was Vampire the Masquerade Bloodlines. It allowed the community to fix the bugs and expand the game, long after support was dropped by Troika Games (RIP). If I was writing a heavily scripted RPG game, then python could possibly be a great choice because I personally find Lua a little too light on standard functionality (i.e it can be fantastic but only if effort has been spent creating i.e maths libraries for it).

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

I often thought "Well, if you can write C in Python, does that not mean you can write a game library in C and call it from Python? Then, really you're using a C library, but with the beginner friendliness of Python!". A great example of this IMO is PyGame: Basically a very thin wrapper of SDL for Python. I, personally, don't like SDL, and maybe that's why I dislike PyGame. You have to do a LOT of stuff yourself e.g. function intervals(for an update/draw function), you have to check for key presses yourself, etc. For C++ I think SFML is a great choice. There is a Python wrapper for SFML, which is probably due to SFML being based on C++, and like mentioned before, you can easily port a C/C++ library to Python with effort. Lua is meant to be great for porting C libraries. I agree, Lua is a little light on the base, but isn't that the point of Lua? It's designed to be lightweight, and part of that is good and part is bad. Good, meaning it's easily implementable in your project(part of the reason a lot of game companies use it over other things like Python or Squirrel), but bad because it doesn't have stuff like OOP or '+=', '-=', '*=', '/=', '++', '--', etc. OOP is easily implementable via tables and metatables though. I, personally prefer Python's way of handling OOP.

[Lua is] bad because it doesn't have stuff like OOP or '+=', '-=', '*=', '/=', '++', '--', etc.

Operator overloading has nothing to do with Object Oriented Programming. Absolutely nothing.

And while we are at it, Lua does in fact support operator overloading.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

It's quite easy to spend a large amount of time describing small features that, for you, mean your language of choice is "the best".

I will start by saying that I love Python. I find I enjoy writing Python more than C++, JavaScript or PHP (and a few other languages in the mix).

Firstly, one of the reasons that we have so many languages is in simple terms, because one person may write a language around one core concept, and thus realising applications / libraries that work with that concept is much easier / runs a lot faster.

One of the significant misconceptions about Python is speed. To some extent these are unfounded. A large proportion of benchmarks that "observe" this result involve a script which is unoptimised. Now, first of all, by unoptimised I don't mean squeezing every last processor cycle out of your application. But, I find that in Python, it's easier to write a slow application because there are many ways of realising an end goal, and not all of them are a good choice in respect to the speed of the application.

However, some of the concerns are valid. Python is interpreted, and with that there comes a loss in performance, with a gain in flexibility. I'm very much interested in PyPy, because there benchmarks (and others using it) are converging upon that of C, and in some optimised cases, outperforming it for certain tasks. Now, the latter is a case of optimisation, as mentioned by a previous poster. It's hard to compare language speed overall because it comes down to where you want to compare (the sample application).

Anyway, I believe that it is inevitable that Python will find itself increasingly at the core of games and large scale software, but whether that's in CPython, PyPy or another implementation remains to be seen.

[Lua is] bad because it doesn't have stuff like OOP or '+=', '-=', '*=', '/=', '++', '--', etc.

Operator overloading has nothing to do with Object Oriented Programming. Absolutely nothing.

^This. Also, in my engine's Lua bindings, I choose not to use the ":" operator.
i.e. instead of writing object:method(arg), i write class.method(object, arg)
...but it's still OOP tongue.png

As a programmer who's been using Python to make games for a few months now (Check out my developer blog to see the code for some basic projects like Pong and Breakout coded in Python), the performance has more to do with how aware you are of python's limitations. I've known since I started Python how fast I could expect it to run and how I would code in it, so I coded using the mindset that I should write the fastest, most readable code I can. And I would only "optimize" it whenever it was actually slow.

So far its been great. For Three-Dimensional games it will probably be just as good if you use the proper algorithms to render efficiently.

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

This topic is closed to new replies.

Advertisement