SoFunction
Updated on 2024-11-21

python's way to get the return value in a callback function

When a callback function is used in python, and the callback function needs to return a value, you need to assign the function passed as the callback function to a variable first, and then when the callback is over, you can retrieve the value of the variable back.

As I used to call xmlreader, a function passed in needs to retrieve the return value of the code:

 # Create an XMLReader
 parser = .make_parser()
 # turn off namepsaces
 (.feature_namespaces, 0)
 
 # Rewrite ContextHandler
 Handler = xmlReader()
 (Handler)
 (info)
 
 print "$$$$$$$$$$$", #Taking values from an object

This allows you to get the values taken from the object.

Above this python in the callback function to get the return value of the method is all I have shared with you, I hope to give you a reference, and I hope you support me more.