Tuesday, July 24, 2007

Python Now

Okay, I've been using Python for a handful of months. I've gotten over the white space as langauge element business. I still don't favor it, but I get it. I personall still prefer braces or something like them for delimiting statement blocks, but I can live with the white space.

There are two unforgivable sins in Python.

The first is that instance variables and method names in an object class definition occupy the same name space! This means you can't have a variable called file and then a method to get/set it cadlled file(). As soon as you write a value to the variable (self.file = something) you've overwritten your method definition! Am I missing something here?

So you either have to use the built in direct access obj.file = something which you can do directly to set (and get), but you've lost the ability to massage data as you set or get it. Or you have to resort to obj.get_file() and obj.set_file(), or a method that does both.

Okay, I forgot what the second one was.

Update 18 Oct 2007: Okay, there is a way. See this post.