Saturday, 28 September 2013

GUI

Recently I received a Python file written by a friend of mine while he was in first year university. It contained a class "Book" and a class "Person". He used these classes to record and store information of people in a book, but the most interesting part about it was that all of it was done in a pop-up window GUI, complete with buttons and text fields.

Although learning GUI is not in the course outline, curiosity overwhelmed me and I decided to break down his code and try to understand how it was done. On that note I've set up a side goal for myself that will run parallel to the course and that is to program a calculator by the end of the course using what I learn in CSC148 and what I learn from my friend's code.

Wednesday, 25 September 2013

Exceptions in Python

After learning a bit more about exceptions today in lecture, I went home and tried to raise as many different types of exceptions as I could. Although the variety of exception I could raise was rather limited, further experimenting revealed many new things to me:

object - > BaseException -> Exception -> ArithmeticError -> ZerroDivisionError
                                                             -> LookupError -> IndexError
                                                             -> SyntaxError
                                                             -> ValueError
                                                             -> NameError
                                                             -> TypeError

I'm sure there are many that I haven't stumbled upon but I did not expect to find so many exceptions built into Python. I'm also waiting for the marks for exercise two, I'm eager to find out how I did on my first attempt at it.