class Modifier :
	
	def __init__(self, stack = True):
		if not isinstance(stack, bool):
			raise ValueError("The parameter 'stack' must be boolean")
		self.functionList = []
		self.stack = stack
		
	def registerModifier(self, function, *params, **args):
		if not callable(function) or not isinstance(params, tuple) or not isinstance(args, dict):
			raise ValueError("This function is not callable")
		runnable = [function, params, args]
		self.functionList.append(runnable)
		
	def __call__(self, *val, **args):
		
		#~ if self.stack or ('stack' in args and args['stack']):
	
		for runnable in self.functionList:
			val = runnable[0](  *(val + runnable[1]), **runnable[2])
			val = (val,)
		return val[0]	
				
		#~ else:
			#~ ret = [None]*len(self.functionList)
			#~ count = 0
			#~ for runnable in self.functionList:
				#~ ret[count] = runnable[0](  *(val + runnable[1]), **runnable[2])
				#~ count += 1
			#~ return ret