From d7b9eeedabc7b3be0a9419f0a02061f6efbaceba 2008-07-28 01:26:39 From: Barry Wark Date: 2008-07-28 01:26:39 Subject: [PATCH] doctest example for NotificationCenter --- diff --git a/IPython/kernel/core/notification.py b/IPython/kernel/core/notification.py index 9225f47..746704d 100644 --- a/IPython/kernel/core/notification.py +++ b/IPython/kernel/core/notification.py @@ -17,7 +17,19 @@ __docformat__ = "restructuredtext en" class NotificationCenter(object): - """Synchronous notification center""" + """Synchronous notification center + + Example + ------- + >>> import IPython.kernel.core.notification as notification + >>> def callback(theType, theSender, args={}): + ... print theType,theSender,args + ... + >>> notification.sharedCenter.add_observer(callback, 'NOTIFICATION_TYPE', None) + >>> notification.sharedCenter.post_notification('NOTIFICATION_TYPE', object()) + NOTIFICATION_TYPE {} + + """ def __init__(self): super(NotificationCenter, self).__init__() self._init_observers()