Python

I seriously haven't really done anything in python in about 2 years, I'm kind of rusty and am finding that I don't really like python as much as I used too. It's fun and fast to program in (sometimes), but my code ends up mangled in classes and inheritance. So I try to write it as if it were C (with classes of course), and am getting better results, but python is using quite a bit of CPU (and ram) and I probably don't know enough about it to optimize. Python has a cute syntax, but boy does it seem like the C++ of dynamic scripting languages sometimes. Python is just too powerful for my small mind to grasp :'(. But the parts I do grasp are awesome!

Ok, pity party over, time to do some serious coding.

What I wrote is probably incoherent, don't consider it a flame or anything, it's just my thoughts on python while coding this week. I'm almost certain I have bad style and need to brush up on the "pythonic" way.

(log in to comment)

Comments

While python may be somewhat slower than C and other traditional languages, i find that it more than makes up for that in general program writing in its language feature and handy builtins make it much better for writing quick programs and games ect.

I haven't used c, c++ that much but whenever i have gone to use that style of language i have found it way more difficult due to being stuck in the mindset of doing things the python way, that said all of my code for this competition is horribly mangled, but thats just due to rushing most of it.
Yeah, when I write in C, I'm almost always doing micro optimizations, so it's nice to just forget about that and get working mechanics in Python.
Python was my first OO language, and I love it.  it does have some quirks, but they mostly relate to how everything is an object.  this differs from java and other languages (even though java is the only other language I really know).  I find that thinking along the lines of functions and data is very difficult, and I end up creating objects in my head and linking them with name prefixes.  the cool thing with python is that you can use it like a procedural language (next challenge for myself, create a game without creating classes... nah) or an OOP language.  and from your C++ comment, is C++ difficult to grasp?  I'm trying to broaden my horizons, but C keeps baffling me since it's completely procedural and I don't work well in that environment.
What I miss the most from C/C++/Java/C#/VN.Net is type safety. Missing type safety converts many compile time errors to runtime errors and extremely reduces the power of the IDE to assist you during programming. Good for prototyping but bad for large projects with multiple developers.
Second: Performance, I think even on current pc's python is much to slow for serious 3d games without moving many parts, like collision, culling, vertex or pixel based operations, render dispatching, physics, skinning, animation and even Particles to native code.

Still fun to work with and for tools, small to medium sized games and prototyping definitely worth a try.

- First time python use
Coming from a completely procedural background, Python still works well for me, especially since I have a tendency to write "spaghetti code". And yes, performance is not near what you can get with a compiled language like C++. But in Python, I can get something working extremely quickly. Compiled language are almost always more focused on the language's power over its readability, so it's nice to use a language like Python that is focused on prototyping for game developing.
Python is slow, indeed. But there are a nice python modules written in C/C++ that helps a lot of in speed such panda3d or numpy. If you need speed then write critic parts in a simple C/C++ module or a C library and load it with ctypes.

"Still fun to work with and for tools, small to medium sized games and prototyping definitely worth a try."

True.
@Python Jedi: (About python being like C++): Yeah. C++ gives you a lot more choice in paradigms and language features (operator overloading, et cetera) which can sometimes be overwhelming compared to something "simple" like C.
 
@Archy: Yeah, I used to hate it, but now I really appreciate type safety.
 
@dotteri: Wait, so I can write my own modules in C and glue it together with python for pyweek? All my code doesn't have to be python? Oh wait, then everybody has to compile my C code :P.
thus another advantage of scripting languages, or java.  but I don't know if jython is appreciated here... animated tiles are being worked on... trying to get one-time animations is tricky business atm.  you could make a library and compile it for many os's/architectures, as well as provide the source, well before pyweek, then use it for your game.  this might help get boillerplate stuff out of the way, but the rules say that the game logic must be in python, so how much can be put into a library is limited.  I think that's enough rambling for this topic...
@tnelsond Pygame, PyOpenGL and more libraries are written in C/C++. Just compile (give a try) the library for Win, Linux and MacOS X. Read Python Jedi post because he explain better than me.
@dotteri, I'm already using Pygame. :P.
@Python Jedi: And my animations are all code generated, at the moment I have no images because there would be too many pictures.
I was talking about my game at the time, sorry, ~10:30 PM is not a good time for me.  anyways, after the mention of the animated tiles, the rest of the post is relevant.  again, up rather late for me, thinking along very short terms, struggling with a rather messy code engine... I'm working on it again, and I think I'm going to make this system into a tile map editor and format, since I like it so much.