1 # @Time     :2019/6/21 14:51
  2 #-*- encoding:utf-8 -*-
  3 
  4 
  5 # 第一题:
  6 #
  7 # class StarkConfig(object):
  8 #     list_display = []
  9 #
 10 #     def get_list_display(self):
 11 #         self.list_display.insert(0,33)
 12 #         return self.list_display
 13 #
 14 # class RoleConfig(StarkConfig):
 15 #     list_display = [11,22]
 16 #
 17 #
 18 # s1 = StarkConfig()
 19 #
 20 # result1 = s1.get_list_display()
 21 # print(result1)
 22 #
 23 # result2 = s1.get_list_display()
 24 # print(result2)
 25 
 26 
 27 
 28 # class StarkConfig(object):
 29 #     def __init__(self):
 30 #         self.list_display = []
 31 #
 32 #     def get_list_display(self):
 33 #         self.list_display.insert(0, 33)
 34 #         return self.list_display
 35 #
 36 #
 37 # class RoleConfig(StarkConfig):
 38 #     list_display = [11, 22]
 39 #
 40 #
 41 # s1 = StarkConfig()
 42 #
 43 # result1 = s1.get_list_display()
 44 # print(result1)  # 33
 45 #
 46 # result2 = s1.get_list_display()
 47 # print(result2)  # 33 33
 48 
 49 
 50 # class StarkConfig(object):
 51 #     def __init__(self):
 52 #         self.list_display = []
 53 #
 54 #     def get_list_display(self):
 55 #         self.list_display.insert(0, 33)
 56 #         return self.list_display
 57 #
 58 #
 59 # class RoleConfig(StarkConfig):
 60 #     list_display = [11, 22]
 61 #
 62 #
 63 # s1 = StarkConfig()
 64 # s2 = StarkConfig()
 65 #
 66 # result1 = s1.get_list_display()
 67 # print(result1)  # 33
 68 #
 69 # result2 = s2.get_list_display()
 70 # print(result2)  # 33
 71 
 72 
 73 #
 74 # class StarkConfig(object):
 75 #     # def __init__(self):
 76 #     #     self.list_display = []
 77 #     list_display = []
 78 #     def get_list_display(self):
 79 #         self.list_display.insert(0, 33)
 80 #         return self.list_display
 81 #
 82 
 83 # class RoleConfig(StarkConfig):
 84 #     list_display = [11, 22]
 85 #
 86 #
 87 # s1 = StarkConfig()
 88 # s2 = StarkConfig()
 89 #
 90 # result1 = s1.get_list_display()
 91 # print(result1)  # 33
 92 #
 93 # result2 = s2.get_list_display()
 94 # print(result2)  # 33 33
 95 
 96 
 97 # ############################################################################################
 98 
 99 # 第二题:
100 '''
101 class StarkConfig(object):
102     list_display = []
103 
104     def get_list_display(self):
105         self.list_display.insert(0,33)
106         return self.list_display
107 
108 class RoleConfig(StarkConfig):
109     list_display = [11,22]
110 
111 
112 s1 = StarkConfig()
113 s2 = StarkConfig()
114 
115 result1 = s1.get_list_display()
116 print(result1)
117 
118 result2 = s2.get_list_display()
119 print(result2)
120 '''
121 # 第三题:
122 """
123 class StarkConfig(object):
124     list_display = []
125 
126     def get_list_display(self):
127         self.list_display.insert(0,33)
128         return self.list_display
129 
130 class RoleConfig(StarkConfig):
131     list_display = [11,22]
132 
133 
134 s1 = StarkConfig()
135 s2 = RoleConfig()
136 
137 result1 = s1.get_list_display()
138 print(result1)
139 
140 result2 = s2.get_list_display()
141 print(result2)
142 """
143 
144 # 第四题:
145 class StarkConfig(object):
146     list_display = []
147 
148     def get_list_display(self):
149         self.list_display.insert(0,33)
150         return self.list_display
151 
152 class RoleConfig(StarkConfig):
153     list_display = [11,22]
154 
155 
156 s1 = RoleConfig()
157 s2 = RoleConfig()
158 
159 result1 = s1.get_list_display()
160 print(result1)
161 
162 result2 = s2.get_list_display()
163 print(result2)

 

posted on 2019-07-05 18:08  嗯哈哈  阅读(156)  评论(0编辑  收藏  举报