Sunday, March 20, 2011

Programming Questions

Two questions:
First, is there a built-in way to iterate over properties?  I have a class that contains a number of properties.  I'd like to also include a function that iterates over those properties.  Is there any easy way to do this?

Second, the above question is the kind of question I'd like to hack away at.  One good way to hack at this problem is to load the class into an interpreter and see what kind of functions I can develop.  Now, I use Gedit as my editor, and it comes with a built-in python interpreter.  How can I load the classes in my current file into the interpreter? 

1 comment:

DFH said...

I answered the 2nd question by exploring different python consoles. If you install the 'better python console' plugin for gedit, you can run the current document in a independent python console. This solves the "crash" problem. And it also allows me to test and play with my classes.

I had tried to install this console before, but I expected it to act like the regular python console. I didn't realise you had to load to it from a document (with F5). Check out the tutorial on their gnome live site.