What do you think about Python instead of C++?

Started by
17 comments, last by tiburon 19 years ago
I personally don't especially like Python, cause personally I prefer to denote code blocks with brackets, but hey that's just me :). If you've tried Python and it works well for you, then by all means go ahead! I wouldn't write an entire game in Python (I mean, down to the pixel plotting routines), but if you can use Python with a powerful C++ backend or extensions, that would be IMHO the best method.

Cheers!
- fyhuang [ site ]
Advertisement
I still haven't got dun dlding Python. Maybe 'cause I am a little busy. I think though that the way everyone talks. YES. Go with it.
My friend wants to learn to program in C++. If he forgets BASIC right away, well, I am worried.
I am just learning Python and so far I love it. I learned how to program in Pascal. Then moved to C. I now mostly use Java but have become frustrated with its lack of elegant solutions to problems that I see more and more as I become an advanced programmer. Most of the problem I have with Java are due to the restrictions it places on you as a programmer.

Python has a different philosophy. It gives you the power to do alot more. This can be a bad thing if you don't do a good job of testing your code. However, if you don't test then your code won't be worth a damn anyway.

It is dynamically typed (never have to cast again) and has built in support for list and hashtable data structures. Things seem to flow much more naturally when I code in Python compared to other languages I have used.

Python does have performance issues with low level graphic (and other CPU intensive) routines. The great thing is it easily allows you to wrap your C, C++, JAVA ... etc routines with Python. You can write all of your high lvl organizational code in python, and then optimize with C where required.

I am starting my own Python community for game developers: http://www.pyoneers.com/ (site is in the process of being redeveloped so excuse the homepage). If anyone would like to join or is in need of a Python game dev volunteer, let me know (uedauhes at yahoo dot com).
Quote:Original post by fyhuang
I personally don't especially like Python, cause personally I prefer to denote code blocks with brackets, but hey that's just me :).

A lot of people take issue with that, but after they give it a chance many seem to get enamoured enough with its other features—readability, expressiveness, speed of development, highly dynamic nature, object-orientation, and so forth—to overlook that little issue. After a while, you might even find yourself preferring it ...

Me, I prefer Python's block indentation. It's the exact same indentation that I used for all my C++ code, anyway, minus the really redundant braces (redundant because they did not express anything that the indentation had not already made clear), which removes unnecessary punctuation, consumes less vertical space, and eliminates the tired old arguments over where the braces should be placed, anyway ...
Quote:Original post by Miserable
Me, I prefer Python's block indentation. It's the exact same indentation that I used for all my C++ code, anyway, minus the really redundant braces (redundant because they did not express anything that the indentation had not already made clear), which removes unnecessary punctuation, consumes less vertical space, and eliminates the tired old arguments over where the braces should be placed, anyway ...


And eliminates the problem of inconsistent indentation. Let's be honest, most of use scan code looking at the indentation, not at whether there's a brace or not. So if the indentation and the braces disagree, the programmer and the compiler have a different view of what the code's structure really is.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Why not do a whole game in python?
here's a couple of games for sample source code:
PyDDR
PySol
A bunch more
There is also a game dev library: PyGame

Should have read last post :| sorry for the dupe
Thanks a lot guys, I'm very surprised for all these answers I got from you. Luckily our project is still in a early status so it wouldn't be a problem to switch to another language. Maybe we could give Python a try, even though I like C, I think this language could make our lives easier. By the way the game should be a 2D point and click adventure, just to let you know. We work on it in our free time (that's not much unfortunately, 'cos of our jobs) and we're enjoying it because it's really great to program something that you love (videogames, in my case)!
Our main goal is to make something easy portable to every system around, above all: AmigaOne. Python should be supported on that system already (its OS is AmigaOS4, not released as final yet) I'll check it out later. I think I can use SDL with python, right? That Pygame library looks interestin, even though I think it hasn't been ported onto Amiga, yet.

Thanks everyone!!

Joe :)
Quote:Original post by bkt
C++ does seem to be the industry standard right now; as others have explained, some firms are still using C code (for example id, their new engine is the only one that is written in C++). A lot of people in the indie industry are migrating to C#, but I'm not sure what the support is on non-Windows operating systems yet. I know that Mono development is going strong, but I haven't been interested enough to look in to if OpenGL is working on *nix.

There is also the D programming language; which I like a lot, the syntax is a mixture of Java, C#, and C++. It basically takes the best of all the languages and puts them together in a new language. There is backwards compadibility C code I believe, and you can link C++ modules. There are a few people writing simple games in that right now (nobody writing AAA titles).

But ultimately, as a Computer Science major (which I am), you can expect to learn ASM, and C/C++. If you wish to take other courses, I'm sure a good school will offer Java, Cobol, and Visual Basic at the least. I plan on taking the Java and Cobol courses just to have them on my resume for the future (already learned VB at vocational school).




I haven't heard of one company that is using C# as their game development language. Python/lua is pretty useful as a scripting language. You just have to know what the right tool is. For example, push the renderer code into the C++ layer and have python code call it.

This topic is closed to new replies.

Advertisement