Is Python underestimated with what it can do?

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

I've read various articles, blog posts, etc on Python: All of which list it's pros and cons, though they tend to either say it's slow or good. It's said to be a good beginners language: And I whole heartily agree. Any programmer can admit Python is a great beginner language. It sets a good example for OOP and encourages people not to use D&D Programs. But, alas, it is said to be bad as well.

Python not for game development? Panda3D, Unity of Command, Frets on Fire, Toontown, EVE Online

But, a lot of people argue that you should not use Python because of speed. Some say it's too slow for anything, others say it's good at some things.

So, my question is: Is Python underestimated? From what I can tell, it seems to be a fairly good language, and it being so simple to pick up makes it a great language. Google Chrome is partially written in Python. Some of Linux is written in Python.

Obviously Python would not be capable of a high-end Call of Duty clone, but really, the only language suited for that is C/C++ simply due to it's speed.

So, what is Python's limits? Is it as good/bad as people make it out to be? I recently finished a programming tutorial series on Python 2.7.2, and it's really got me into Python.

A lot of programmers start with Python now-adays, but they tend to only start with Python.

I'm not sure if it's true, but I've heard of some viruses being written in Python as well. I've heard you can do a man-in-the-middle attack with Python, using a certain library. I wouldn't like to do this; not only because it's illegal, but because I believe there are other languages better suited toward this. Also, I'm not so sure it'd be easy to cover your tracks in Python.

Python is also meant to be quite good at making the GUI's, and letting another language like C or C++ do some of the heavy work.

All in all, this is just to satisfy my own curiosity. In my opinion: Python is a great language! I often use it to test some ideas for game development quickly. It's fast at prototyping ideas, I'll give it that.

Also, I'd like to point out that Gimp was written in C/C++, and it's quite slow at responding a lot of times. I find that writing GUI's in Python is actually quite fast(for the coding of it and for the response time). So I guess some of it depends on how efficient your program is.

Advertisement

I think you summed it up well enough.

Python is a great language on its own. It has many strengths. String processing and filesystem manipulation are among those strengths.

Python also has weaknesses. Some things are difficult to accomplish, and many operations require a deceptively large amount of processing power.

Personally I find that Python is most useful in tools. Many tools operate on the command line. Many tools operate with text-based intermediate file formats. Having a Python script manipulate XML documents is easy. Having a Python script manage complex conditional build scripts is often straightforward.

Python is an excellent language. It is one of several that I recommend all programmers become conversant in. (The others must-know languages include C++, C#, Java, JavaScript, and Perl.)

You described it well: Python is good at making tools. Integrating it with Java could mean making GUI's in Python(since it's so simple to do so), and have Java do the heavy stuff. I believe Minecraft uses Jython.




Obviously Python would not be capable of a high-end Call of Duty clone, but really, the only language suited for that is C/C++ simply due to it's speed.

When people say python is "slow", this is what they mean. Lots of people go into gamedev thinking they're going to make the next CoD, or that learning anything that won't go towards eventually making the next CoD is a waste of time.

It's great for certain classes of tools (e.g. the ones that don't involve heavy GUI development, like a map editor or something -- I'd use C# for that), for scripting and for embedding into other games to write code more productively.

It's not very fast. However, that's not something that should be examined in a vacuum. The only important question is whether a language is "fast enough" for your needs. for 99% of the people working in gamedev in any way, shape, or form, python is "fast enough".

There are certainly gripes I have with the language. I think it's hard to work with on projects of scale. I think it's slow for certain classes of projects, and it's very hard to actually optimize it for speed when you have to due to the heavy abstractions in the language (though you can always convert stuff to C). However, I think most people recognize python as a vital tool, and really, along with Lua, C#, C++, and Java, it's one of the most popular languages for gamedev, so I don't realy think it's "underestimated" at large.

Obviously Python would not be capable of a high-end Call of Duty clone

Some parts of call of duty ARE written in a slow, interpreted language... So actually, python definitely could be used to replace those particular parts of the COD code base.
AAA games are made using many languages, exploiting the strengths and mitigating the weaknesses of each of them.

It's also worth pointing out that there are efforts underway to make Python much, much faster.

Don't expect it to catch up to C anytime soon, but the performance difference is nowhere near as large as it used to be...

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


I'd like to point out that Gimp was written in C/C++, and it's quite slow at responding a lot of times.

The gimp is written in C (not C++) and is very fast. It has a scripting extension that uses Scheme, because developing in a scripting language (like Python) is very fast compared to developing in C (in particular, the Gimp ToolKit, aka GTK). If you find something in the gimp to be unresponsive, it's likely a scripted part, both because interpreting scripts is relatively slow and because those parts tend to do massive data processing.

The first big advantage of Python is rapid development time. In today's world of disposable everything, the cost of a developer's time needs to be minimized so an application can get to market as quickly as possible. Python has a lower learning curve so you can hire inexperienced, inexpensive developer monkeys to churn out code, and since the product is disposable it doesn't have to work well, it just has to get into consumers' hands quickly so money can be exchanged.

The second big advantage is the Python is Fast Enough. Yes, it's slower than native code, but humans are slow. When it comes to most human interaction software, you do not need the fantastic speed geeks brag about. The parts that do need speed can be delegated to lower levels written in native code (for example, OpenGL).

Combine those two advantages, and it makes Python an excellent and recommendable choice for not only a first language when learning programming, but a go-to language for many general purposes. It's not always the best tool for a particular job, but it's an appropriate tool for many jobs, including game development.

Stephen M. Webb
Professional Free Software Developer

Some very interesting replies. Python will never replace C or C++, but it doesn't need to. You can write C in Python, and C is pretty much as fast as Python. I think you can also write C++ in Python, though you might need a library or something. I've never looked into it(mostly because I'm not too fond of C++, and just really don't want to look into C Python until I've learned a lot more of Python(e.g. How to parse XML and JSON and such)).

It's fast prototyping makes it a valuable language, as a few people mentioned.

It's good to know there are efforts to make it faster. I saw a benchmark somewhere, and it said that Java 7 was slightly faster then Python, but Python's catching up. Java is a good language for game development(at least IMO), so does this mean if Python gets "much, much" faster, it would get as fast(if not faster) than Java? Either way, if it's almost as fast as Java, that's proof enough for me that Python is underestimated and under-ranked.

I'd also like to say that Python might not be good for writing games entirely, but maybe as a scripting language for games. For example, World of Warcraft was written in C/C++, but uses Lua for scripting.

Another thing: Python is faster than Lua, I think. I saw a benchmark somewhere comparing Lua, Python, Java and C#(C# won, By the way). This is strange, because Garry's mod is mostly(if not entirely) written in Lua. I've briefly played Garry's Mod, and I didn't see any performance issues. At the very least you can write add-ons in Lua, but even then they are very responsive. I'm not sure about this, and haven't seen anything to back this up, but apparently the guy that wrote Garry's Mod made a language based on Lua to code it. What leads me to believe this is false is that when the game is loading, I see it says "loading *.lua". If it was written in Lua, and Python is faster then Lua, then could you not write a game like Garry's Mod in Python? AFAIK Lua is interpreted too. I did get a little side-tracked, but it's still got to do with Python.

If Python got faster then Java, it'd be the ultimate beginners language because:

1) Easy to learn

2) It'd be fast -- Assuming we're in the future when it's "much, much faster"

3) You could write basic 3D games in it(Panda3D)

4) You could write an awesome 2D game(PyGame, PyGlet, Cocos2d)

5) It can be used as a scripting language in games

6) Kids can learn it easily, helping young people get into code the right way(not using GameMaker or anything)

Also, CoD games are usually not written in a language at all from the developer, from what I've heard. If they are, it's usually C/C++, but not often. They usually use Game Makers like Unreal Engine or UDK or something. Maybe this is false, but I thought'd I'd put that out there.

Don't get me wrong: I love Python, I really do, but I just wish it could be used for more uses and people saw how much of a good language it is - For beginners and Experts alike.

You can write C in Python, and C is pretty much as fast as Python. I think you can also write C++ in Python, though you might need a library or something.

Nope. Though there are a number of ways to write C extension modules that can be loaded by Python programs (ctypes, Cython, etc.)

I saw a benchmark somewhere, and it said that Java 7 was slightly faster then Python, but Python's catching up.

Benchmarks are easily manipulated. If you look around the internet, you can individual benchmarks where Java or Python are hundreds of times faster than C/C++. They are not however representative of general performance.

Another thing: Python is faster than Lua, I think. I saw a benchmark somewhere

Again, benchmarks are flexible. Last I checked LuaJIT was faster than Python on most benchmarks, but your mileage may vary.

This is strange, because Garry's mod is mostly(if not entirely) written in Lua. I've briefly played Garry's Mod, and I didn't see any performance issues.

Language performance has (perhaps surprisingly) very little to do with the performance of software. Computers are fast, you can write performant software in "slow" language, and many people manage to write hideously slow software in C++.

Also, CoD games are usually not written in a language at all from the developer, from what I've heard. If they are, it's usually C/C++, but not often. They usually use Game Makers like Unreal Engine or UDK or something. Maybe this is false, but I thought'd I'd put that out there.

Most commercial games are built using game engines, yes. But those game engines have to be written in something... Usually C++.

Don't get me wrong: I love Python, I really do, but I just wish it could be used for more uses and people saw how much of a good language it is - For beginners and Experts alike.

You seem to be missing the fact that Python is already a hugely popular and successful programming language:

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

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.

This topic is closed to new replies.

Advertisement