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.



No comments:

Post a Comment