#NEWLINE# @ contextmanager #NEWLINE# def listen_for( signal ) : #NEWLINE# #INDENT# caught_signals = [ ] #NEWLINE# def handler( sender , **kwargs ) : #NEWLINE# #INDENT# caught_signals . append ( ( sender , kwargs ) ) #NEWLINE# #UNINDENT# with signal . connected_to ( handler ) : #NEWLINE# #INDENT# ( yield caught_signals )