|
PageName
DocumentationContains information on methods and member variables used to implement watch list feature DetailsMember VariablesLearn about frames Please refer to the table in the link for information about python frame's data structure. self.watch_list: It's a python dictionary. The key for each dictionary is a tuple of frame object and the variable name. The value for the dict is again a tuple. The first element of the tuple contains the reference or the value (based on the variable type) of the variable. The second element of the tuple contains a duplicate of the variable via copy.deepcopy. So it can be represented as, If a is the variable, that is being watched, then self.watch_list would be like {(<frame object at xxxxxx>, 'a') : (a, copy.deepcopy (a))}self.frames_watched: It's a list containing the different frames that are being currently watched. self.variables_watched_in_frame: It's also a dictionary. The key for dictionary is a frame object. The value for dictionary is the list of variables that are being watched in the frame. Functions:def is_same (self, obj1, obj2, verbose = False, traversed = None): Compares two objects and says if they are alike or not. Cannot compare
2) File object Objects Left out
TODO
def set_watch_list (self, frame, var): Adds the specified frame and variable to self.watch_list member variable. Please refer above as how data is stored in self.watch_list member variable. def check_watch_list (self, frame): Checks if the variables that are being currently watched has their values changed or not. def update_watch_list (self, frame, arg): Updates watch list if needed. Watch list updates need to happen when mutable datatypes like list and dict are watched. Consider the below scenario .... a = [] #Variable a is being watched, say the frame is F1 func (a) ... def func (x): x.append (4) # Variable a would be modified here but this would happen in frame F2 In this case, the variable a that is watched in frame F1 would be modified under the name x in frame F2. When function call func (a) is made, the self.watch_list will be updated with the new variables to be watched. So, {(<frame object at xxxxxx>, 'a') : (a, copy.deepcopy (a))}would become as {(<frame object at xxxxxx>, 'a') : (a, copy.deepcopy (a)),(<frame object at yyyyy, 'x'>): (x, copy.deepcopy (x))}def prune_watch_list (self, frame, arg): When a frame is exited, we can clear about our member variables with the information on that frame. Add your content here. Format your content with:
|