first of all sorry for this easy question. I have a class
class Grid(object):
__slots__= ("xMin","yMax","nx","ny","xDist","yDist","ncell","IDtiles")
def __init__(self,xMin,yMax,nx,ny,xDist,yDist):
self.xMin = xMin
self.yMax = yMax
self.nx = nx
self.ny = ny
self.xDist = xDist
self.yDist= yDist
self.ncell = nx*ny
self.IDtiles = [j for j in np.ndindex(ny, nx)]
if not isinstance(nx, int) or not isinstance(ny, int):
raise TypeError("an integer is required for nx and ny")
where
xMin = minimum x coordinate (left border)
yMax = maximum y coordinate (top border)
nx = number of columns
ny = number of rows
xDist and yDist = resolution (e.g., 1 by 1)
nx and ny need to be an integer. I wish to ask where is the most elegant position for the TypeError. Before all self. or in the end?