Doubt regarding python


I don’t understand how we are taking a function as an argument for another function? Is this even possible? And even if we are then how are we giving an argument to the data_augmenter function because while defining data_augmenter it has no arguments?

{moderator edit - solution code removed}

Yeah that is possible in python to use the output of a function as an argument to another function. Data_augmenter has no arguments but inside it is initialising an instance of the class sequential, and performing some operations in it and outputing, so it has a return output. This output which initializes an instance and performs some operations is fed into the alpaca function, but it is an instance of a function not a variable. Apparently python is very flexible with argument and return types.


Yes, in python you can pass an object reference to a function as a parameter. A function can also return a function object as a return value. Both of those features are being used in this instance.