aitjcize / PyTox

Python binding for Project-Tox the skype replacement.
GNU General Public License v3.0
96 stars 29 forks source link

Magic name callbacks -> decorators #41

Open dubslow opened 9 years ago

dubslow commented 9 years ago

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.)