Skip to content

Instantly share code, notes, and snippets.

Jeroen Pelgrims resurge

Block or report user

Report or block resurge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

View gist:3142854

test test
test

foo = 1
bar = 2

asfgasf

@resurge
resurge / python events.py
Created Aug 27, 2010
In relation to this blog post: http://blog.jeroenpelgrims.be/2010/08/using-c-style-events-in-python/ and the question posed in the comments. Would like some help improving the code.
View python events.py
class Event(object):
def __init__(self):
self.__handlers = []
def subscribe(self, handler):
self.__handlers.append(handler)
def unsubscribe(self, handler):
self.__handlers.remove(handler)
View mkdict usage.py
from mkdict import mkdict
d = mkdict({
'key1' : 'value1', #regular dictionary usage
('key2', 'key3') : 'value2' #these tuple keys will be unpacked to regular keys
})
print d['key1'] #value1
print d['key2'] #value2
print d['key3'] #value2
You can’t perform that action at this time.