#NEWLINE# def join( self , track_segment_no , track_segment_no_2 = None ) : #NEWLINE# #INDENT# '\n        Joins two segments of this track. The segments will be split in place.\n\n        Parameters\n        ----------\n        track_segment_no : integer\n            The index of the first segment to join\n        track_segment_no_2 : integer\n            The index of second segment to join. If track_segment_no_2 is not\n            provided,the join will be with the next segment after\n            track_segment_no.\n        ' #NEWLINE# if ( not track_segment_no_2 ) : #NEWLINE# #INDENT# track_segment_no_2 = ( track_segment_no + 1 ) #NEWLINE# #UNINDENT# if ( track_segment_no_2 >= len ( self . segments ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# new_segments = [ ] #NEWLINE# for i in range ( len ( self . segments ) ) : #NEWLINE# #INDENT# segment = self . segments [ track_segment_no_2 ] #NEWLINE# if ( i == track_segment_no ) : #NEWLINE# #INDENT# second_segment = self . segments [ track_segment_no_2 ] #NEWLINE# segment . join ( second_segment ) #NEWLINE# new_segments . append ( segment ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( i == track_segment_no_2 ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_segments . append ( segment ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . segments = new_segments