#NEWLINE# def cache( self , delete_lineage = False ) : #NEWLINE# #INDENT# '\n        Caches the result of the Sequence so far. This means that any functions applied on the\n        pipeline before cache() are evaluated, and the result is stored in the Sequence. This is\n        primarily used internally and is no more helpful than to_list() externally. delete_lineage\n        allows for cache() to be used in internal initialization calls without the caller having\n        knowledge of the internals via the lineage\n\n        :param delete_lineage: If set to True, it will cache then erase the lineage\n        ' #NEWLINE# if ( ( len ( self . _lineage ) == 0 ) or ( self . _lineage [ ( - 1 ) ] == transformations . CACHE_T ) ) : #NEWLINE# #INDENT# if ( not isinstance ( self . _base_sequence , list ) ) : #NEWLINE# #INDENT# self . _base_sequence = list ( self . _base_sequence ) #NEWLINE# self . _lineage . apply ( transformations . CACHE_T ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . _base_sequence = list ( self . _evaluate ( ) ) #NEWLINE# self . _lineage . apply ( transformations . CACHE_T ) #NEWLINE# #UNINDENT# if delete_lineage : #NEWLINE# #INDENT# self . _lineage = Lineage ( ) #NEWLINE# #UNINDENT# return self