Tuesday, 17 July 2012

Toying With Python

Although I've simultaneously started about an infinite number of different programming things, one thing I've wanted to do for a while is teach myself another language.  C# looked interesting, but the fact it had C in the name deterred me, because for now I want to pick something a bit further from home.

I picked python.  It's taken me maybe three or four days to get comfortable enough with the syntax, not bad considering C++ took about 5 years.  Obviously there is a huge amount in common, and python takes a lot of the worries of the programming.  I'm really enjoying it, and it will be nice to know a language, that although a bit slower, lets you put something rough together really quickly.  It has also allowed me to really quickly create a basic game, so I might use it while I learn the basics of 2d games.


I also think that python would be a really good place to teach programming.  For something like secondary education, where people have little motivation, the langauge is much less fussy and would hopefully inspire people to make it their own.  Although less picky, in terms of memory allocation and so on, it is much better at enforcing good style, indentation a requirement for programs to work.  Also, the fact it's interpreted obviously means no compilation is required, so from the perspective of the school, it would be much simpler, because they can just create a script and run it.

One observation though as a C/C++ programmer is it feels very odd declaring a variable without a type, and I'm finding it hard to move from strongly typed way of doing things - python lets you move freely between types, which feels very unnerving from a C perspective.

The plan is to keep it up on the side (or the side of the side).  Over the summer holidays, I'm going to try and experience 3 or 4 different languages.   I think it would be good to get a taste of different languages, things like Lisp, perl or haskell, that could maybe give me a different programming outlook.

My first "game" in python using pygame, note the programmer art

No comments:

Post a Comment