Tuesday, 3 December 2013

Week 11

This post is relative to week 11 of CSC148 (Nov 18-22).
This week's lab was a bunch of fun. A link to the paper can be found here. I looked up some sources to confirm my results and found this site. 
Apart from that not very much new information was given, there was a cool example of the zip(),property() functions of python in the lecture notes...
>>>zip(['2','4','f'],['a','b','%'])
>>>['2a','4b','f%']    
Somehow I've never seen encountered zip().
property() simply protects a target variable..
(example given):
def get_children(self: 'RegexTreeNode') -> list:
"""get private children""" return self._children
children = property(get_children, None, None, None)
In this event, attempting to modify self.children will have no effect:
#c is in instance containing the above function c.children = someobject
Calling c.children after the above code was executed will not return someobject, but rather whatever c._children is.

No comments:

Post a Comment