Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Borg(object):
- __shared_state = {}
- def __init__(self, size=512):
- """
- """
- self.__dict__ = self.__shared_state
- if len(self.__shared_state.keys()) == 0:
- self.mem_size = size
- self.blks_avail = size
- self.blks_used = 0
- self.process_table = {}
- def __str__(self):
- return "%s" % (self.mem_size)
- def printd(self):
- print(self.__dict__)
- class BorgChild(Borg):
- def __init__(self,size=512):
- super().__init__(size)
- self.my_mem_size = size
- def print(self):
- return dir(self)
- def __str__(self):
- return "My:%s,Parent:%s" % (self.my_mem_size,self.mem_size)
- def printd(self):
- print(self.__dict__)
- B = Borg(2048)
- B.printd()
- B1 = BorgChild()
- B2 = BorgChild(1024)
- B1.printd()
- B2.printd()
- B.printd()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement