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

Suggestion: single function per callback #9

Open
rlepigre opened this issue Jan 10, 2021 · 2 comments
Open

Suggestion: single function per callback #9

rlepigre opened this issue Jan 10, 2021 · 2 comments

Comments

@rlepigre
Copy link
Collaborator

Instead of having two functions set_*_callback and unset_*_callback for each callback, I think it would be simpler to only have set_*_callback, and have it take an optional function as argument (the Some case installing a callback, the None cas removing it). What do you think?

@craff
Copy link
Owner

craff commented Jan 10, 2021 via email

@rlepigre
Copy link
Collaborator Author

I find a bit bizarre to have the default with no extra arg removing the call-back.

It does make sense if you see it in the following way:

  • with set_idle_callback None you set the idle callback to be no callback,
  • with set_idle_callback (Some f) you set it to be function f.

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

2 participants