Skip to content
New issue

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

Can't use closure function for subscribe callback function #50

Open
windslinux opened this issue Sep 5, 2020 · 0 comments
Open

Can't use closure function for subscribe callback function #50

windslinux opened this issue Sep 5, 2020 · 0 comments

Comments

@windslinux
Copy link

from pubsub import pub

def localCall(func):
def real_func(data):
print("In real function : {}".format(data))
func(data)
return real_func

def localUpdate(data):
print("In local update")

pub.subscribe(localCall(localUpdate), "update")
pub.sendMessage("update", data="updateUI")

In the example above, the function localUpdate can't be called. I have no idea why the closure function can't be called?

@windslinux windslinux changed the title Can't use closure functions for subscribe callback Can't use closure function for subscribe callback function Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant