PyTox
PyTox copied to clipboard
Magic name callbacks -> decorators
In my opinion, magically named callbacks are A Bad Idea™. Instead, it would by more pythonic IMO to use decorators to satisfy a callback, e.g.
def MuhTox(Tox):
@OnFriendMessage
def muh_echo(self, friend_num, msg):
self.send_message(friend_num, msg)
(Python itself does have magic names, but they are all dundered. I still think that in this case, decorators are more pythonic than dundered names anyways.)