-
-
Save mmattice/6adada2509f1d94ec336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test on delivery | |
def register(key): | |
def decorator(method): | |
method.response = key | |
return method | |
return decorator | |
@register('$') | |
def msgtype_DOLLARSIGN(self, blah): | |
pass | |
class Whatever(object): | |
def __init__(self): | |
self.registry = {} | |
for x in (getattr(self, k) for k in dir(self)): | |
if callable(x) and hasattr(x, 'response'): | |
self.registry.update({getattr(x, 'response'): x}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment