Advertisement
Guest User

Untitled

a guest
Jan 8th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Foo:
  2.     def __init__(self, num):
  3.         self.l = [[0]*num]*num
  4.  
  5.     def get_list(self):
  6.         return self.l
  7.  
  8.     def update_list(self, val):
  9.         self.l = list(map(self._add_line, self.l, [val]*len(self.l)))
  10.  
  11.     def _add_line(self, num_list, val):
  12.         return list(map(self._add_num, num_list, [val]*len(num_list)))
  13.  
  14.     def _add_num(self, num, val):
  15.         return num+val
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement