Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of the phrase "registering a callback" with Python APIs? [closed]

I'm trying to get into the details about how Python 3 APIs are designed, when adding elements to an UI using APIs from modules available inside applications that offer a python 3.x interpreter I'm asked to register a callback in order to be able to use my functions/scripts: what does "registering a callback" means from the Cpython's point of view ?

like image 395
user2244984 Avatar asked Apr 10 '13 18:04

user2244984


1 Answers

typically, it means that you create a function:

def foo(some,arguments):
    pass #do something here

and then you pass that function to some class in the provided API:

API_class_instance.register_callback(foo)

Now the API_class_instance will call foo under the documented circumstances.

like image 181
mgilson Avatar answered Oct 04 '22 17:10

mgilson