Sorry for the delay all! Been away all weekend at a debate tournament with no wifi, so I was unable to update my blog in time.
This week I will be talking about "exceptions" and when to "expect" them (some funny python humour). Exceptions are something I was very familiar with in python-due to the amount of syntax errors I have made in the past. Exceptions are something to are in a sense "ingrained" in the programming language of python-but they only appear when you make a mistake, or do something to PYTHON considers is invalid to run your code. That begs the question though-what happens when you wish to call exceptions yourself, even if Python believes your code is valid in terms of its syntax and how it runs? This is where the idea of hard coding in exceptions comes from. To code an exception, we use our knowledge from OOP, and code them as a class, and inherit them from other exceptions. By this I mean if we were to hard code in some exceptions, we would inherit our new class exceptions from other ones, such as the general python "Exception".
Over the past week, I have had some experience dealing with exceptions, and understanding how they work. The lab this week really emphasized my understanding of this topic, as I was able to, through coding the "travel_to_new_pos" function, understand when and how the exception the needed to be raised in certain instances. Furthermore, throughout this lab- I was able to understand the exceptions even more, when it came to implementing the NotImplementedError, which I realized is extremely helpful, when we have method calls in 2 different classes, and we wish to show that we can't seamlessly merge them together.
For my blog this week, I would like to call to attention, to two different blogs, and comment upon them.
Firstly- http://alexcsc148slog.blogspot.ca/. In it, he said he had trouble with figuring out the solution to the second lab, for shifting the list, without increasing the complexity of the overall program. As a hint to offer him, I would suggest he consider looking at the list with "nodes", and looking up the concept of a linked list-where the first and the last members of a list are what is remembered and stored by the computer. I am sure he will get it in due time.
Secondly, I wish to comment upon the blog http://csc148mn.blogspot.ca/. In it, he describes (in my opinion), the fantastic learning method, and steps he took to understand exceptions, and how the try/except clauses work, when you look for exceptions in your code. I really enjoyed his post, since he talked about a lot of the main issues I faced, when learning this concept myself.
That's all for now!
No comments:
Post a Comment