Exceptions were also made more clear this week, and the creation of new Exceptions by sub-classing the Exception class was also explained.
Other things learned this week:
Try: This function tests the following lines of code. If it reaches an exception it looks for an except statement further below that matches the exception, and then proceeds accordingly.
print Exception('string') prints the string
Class variables are variables that exist in class and are universal with all methods. This is where the property function comes in play
To reverse a list, [ : : -1] is used
__repr__ is used when representing a class. This means that when you type something like
>>> toy = Toy()
and then you type toy in the python shell like this,
>>> toy
you get something other than the default return
ex:
>>> Toy()
No comments:
Post a Comment