[Github-comments] [geany/geany-plugins] geanypy: Use Python callback return value for keybindings return value (#809)

Colomban Wendling notifications at xxxxx
Sat Jan 5 22:20:36 UTC 2019


> The only question is whether the semantics make any sense, as in whether returning nothing in the Python function should default to returning `FALSE` to Geany. The [API Reference](https://www.geany.org/manual/reference/keybindings_8h.html#afb2861d240a298186fe4d84430e5066f) makes it sound like this is not the normal case.

It's a good question, but it will always be better than the current situation that returns a more or less random value -- I'm not sure if it's undefined or implementation defined behavior, but GCC seems to return 0.
In practice, this seems to lead to no change if the Python function doesn't return, but allows it to return a value that will be passed along.

If you want returning `True` as the default case, I'm not sure what the best solution is but maybe simply assuming `None` means *"didn't return a value"* might be good enough, as it's the default return value, and not a valid value for an explicit return.

> It may be useful in either case to improve [the doctstrings](https://github.com/geany/geany-plugins/pull/809/files#diff-8c19fc53e5ac665274c8ae6877c63a84L145) to clarify this, as a separate change if need be.

Yep, definitely.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/809#issuecomment-451696211
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190105/34bac257/attachment.html>


More information about the Github-comments mailing list