#NEWLINE# def commonprefix( m ) : #NEWLINE# #INDENT# 'Given a list of pathnames, returns the longest common leading component' #NEWLINE# if ( not m ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# s1 = min ( m ) #NEWLINE# s2 = max ( m ) #NEWLINE# for ( i , c ) in enumerate ( s1 ) : #NEWLINE# #INDENT# if ( c != s2 [ i ] ) : #NEWLINE# #INDENT# return s1 [ : i ] #NEWLINE# #UNINDENT# #UNINDENT# return s1