#NEWLINE# def pop( self , last = True ) : #NEWLINE# #INDENT# if ( not self ) : #NEWLINE# #INDENT# raise KeyError ( 'set is empty' ) #NEWLINE# #UNINDENT# key = ( next ( reversed ( self ) ) if last else next ( iter ( self ) ) ) #NEWLINE# self . discard ( key ) #NEWLINE# return key