Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Magic name callbacks -> decorators #41

Open
dubslow opened this issue Jan 27, 2015 · 0 comments
Open

Magic name callbacks -> decorators #41

dubslow opened this issue Jan 27, 2015 · 0 comments

Comments

@dubslow
Copy link

dubslow commented Jan 27, 2015

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

@dubslow dubslow changed the title Magic name callbacks? Magic name callbacks -> decorators Jan 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant