Saturday, July 02, 2005

My First Python Program

# This program outputs itself
import sys

f = open(sys.path[0] + "\\" + sys.argv[0], 'r')

Cool no?

I remember one of our Computer Science Lecturers saying this used to be a homework assignment and would cause endless problems (I'm guessing in C - a compiled language which would have meant far more problems). We were never assigned it .... but it always bugged me. Now a mere year or so later and behold I have the answer.

If you know python I guess you can get it even smaller! (possibly)

It's cool but I like a nice Visual Studio .net IDE to go along with a programming language. An good IDE is nearly as important as the language itself, in my book.

For python I played with VIM for a bit but gah - how much do you have to learn and set up just to start! So then I got Crimson and I could blunder through the setup process much easier. It's cool but it's a general editor.

Tommorrow I'm reconsolidating my game (making all those little programs form one big one). Then I'm fleshing out some menus and probably going some GUI art.

No comments: