I think it is a relatively advanced usage in Python. I don't know if it is available in C. The special thing here is that since an interface has been made public, I cannot modify the function prototype, however, another function that accepts a parameter needs to pass the parameter it receives to a public function (of course, the data is correct). Therefore, you need to do so.
# ! /Usr/bin/ENV Python # -*-Coding: UTF-8 -*- ''' A very advanced usage in Python: applyapply accepts two parameters: function pointers and meta groups (it seems that there are other more advanced usage). When applying calls a function executed by a function pointer, splits the tuples into parameter lists and passes them to the function. ''' Import Weburls = ( ' /App1 ' , ' App1 ' , ' /App2 ' , ' App2 ' , ' /App3/(\ W *) ' , ' App3 ' , ' /App4/(\ W *) ' , ' App4 ' , # Agreed Interface ) Web. config. Debug = Falseapp = Web. Application (URLs, globals ()) Class Pagebase: Def _ Init __ (Self): Self. funget = Self. Get self. Get = Self. Get Def Get (self ,* ARGs): wi = Web. Input () If Hasattr (WI, " ID " ): Self. s = WI. ID Else : Self. s = " Hello " # Pay attention to the apply call. For more information about this function, seeCodeTop Return Apply (self. funget, argS) Class App1 (pagebase ): Def Get (Self ): Return Self. s Class App2 (pagebase ): Def Get (Self ): Return Self. s Class App3 (pagebase ): Def Get (self, ID ): Return ID Class App4 (pagebase ): # The interface has been agreed, and I do not have permission to declare that this function supports variable parameters. Def Get (self, id1, Id2 ): Return Id1 + " , " + Id2 If _ Name __ = " _ Main __ " : App. Run ()