Skip to content

Instantly share code, notes, and snippets.

@daboross
Created June 16, 2014 01:45
Show Gist options
  • Save daboross/ff8d4a954c5a0f288b74 to your computer and use it in GitHub Desktop.
Save daboross/ff8d4a954c5a0f288b74 to your computer and use it in GitHub Desktop.
Concise example
class BaseEvent:
def __init__(self, bot=None, conn=None, hook=None, base_event=None):
self.bot = bot
self.conn = conn
self.hook = hook
if base_event is not None:
# We're copying an event, so inherit values
if self.bot is None and base_event.bot is not None:
self.bot = base_event.bot
if self.conn is None and base_event.conn is not None:
self.conn = base_event.conn
if self.hook is None and base_event.hook is not None:
self.hook = base_event.hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment