Posted on November 10, 2009
from python import Modules, Classes, Namespaces
Last few days I had some time (while sitting on the train) to have a good look at the second part of the Python docs tutorial. I’ve now got a good understanding of everything up to classes, and know the most important language specific notations, behaviours and features.
So far, Python strikes me as a really nice language, with quite some features I haven’t come across before. Especially the data sequence types are neat, and you can do multi inheritance. There are a few things that I find rather odd though. These include the ability to simply add methods and fields dynamically to classes, and the inability to make class fields private, or write-only. This obviously goes against the encapsulation principle. A minor, but really awkward behaviour difference to the other languages I know is the working of the ‘whole division’-operator (in Python this is //). It works by doing a normal division and then math.floor’ing it. For positive numbers, this is no problems, but for negative numbers, you end up having a value that’s 1 off. For example, -7 // 2 will return -4, instead of -3.
Anyway, the final part of my Python studies will be to get a closer look at the Standard Library, how I can best compile applications into executables, and what GUI (and other) libraries I can use.