We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm trying to set up a Queue based resolver, running in two threads:
To identify the original caller in the callback, I need to pass on additional parameters, but currently it's not possible.
It would be nice to have the following:
def cb(result, error, data): print result print error print data channel.gethostbyname('google.com', socket.AF_INET, cb, data)
Data should be any type of python object, passed to cb as the third argument.
The text was updated successfully, but these errors were encountered:
You can do that with a partial object, as follows:
from functools import partial def cb(data, result, error): print data, result, error channel.gethostbyname('google.com', socket.AF_INET, partial(cb, data))
Note that anything you pass to the partial object will come before the result and error arguments.
Is this a workable solution for you?
Sorry, something went wrong.
Perfectly, thanks!
No branches or pull requests
Hi,
I'm trying to set up a Queue based resolver, running in two threads:
To identify the original caller in the callback, I need to pass on additional parameters, but currently it's not possible.
It would be nice to have the following:
Data should be any type of python object, passed to cb as the third argument.
The text was updated successfully, but these errors were encountered: