'Store the arguments as public members
in python, what is the meaning of "Store the pattern in the public member output and return a copy"?
for example how can I create a copy from this class?
class Checker():
def __init__(self,resolution,tile_size):
self.resolution=resolution
self.tile_size=tile_size
if np.mod(resolution, tile_size) != 0 :
raise ValueError(' resolution that are evenly dividable by 2· tile size ')
else:
self.mult=int(resolution/(tile_size*2))
def draw(self):
bl_tile= np.zeros((self.tile_size,self.tile_size))
wh_tile= np.ones_like(bl_tile)
wb_matrix1=np.concatenate((bl_tile,wh_tile),axis=1)
wb_matrix2=np.concatenate((wh_tile,bl_tile),axis=1)
wb_matrix=np.concatenate((wb_matrix1,wb_matrix2),axis=0)
self.output=np.tile(wb_matrix,(self.mult,self.mult))
return self.output
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|