parameters: (a, b, fromfile, tofile)
return_statement: return difference
docstring: Returns the first few lines of a difference, if there is one.  Python
      diff can be very slow with large objects and the most interesting changes
      are the first ones. Truncate data before sending to difflib.  Returns None
      is there is no difference.
docstring_summary: Returns the first few lines of a difference, if there is one.  Python
      diff can be very slow with large objects and the most interesting changes
      are the first ones. Truncate data before sending to difflib.  Returns None
      is there is no difference.
docstring_tokens: Returns the first few lines of a difference if there is one . Python diff can be very slow with large objects and the most interesting changes are the first ones . Truncate data before sending to difflib . Returns None is there is no difference .
function: def first_diff(a, b, fromfile, tofile):
      """Returns the first few lines of a difference, if there is one.  Python
      diff can be very slow with large objects and the most interesting changes
      are the first ones. Truncate data before sending to difflib.  Returns None
      is there is no difference."""
  
      # Find first diff
      first_diff_idx = None
      for idx, val in enumerate(a):
          if val != b[idx]:
              first_diff_idx = idx
              break
  
      if first_diff_idx == None:
          # No difference
          return None
  
      # Diff to first line of diff plus some lines
      context = 3
      diff = difflib.unified_diff(a[:first_diff_idx+context],
                                  b[:first_diff_idx+context],
                                  fromfile,
                                  tofile)
      difference = "\n".join(diff)
      if first_diff_idx + context < len(a):
          difference += "\n*** Diff truncated ***"
      return difference
function_tokens: def first_diff ( a , b , fromfile , tofile ) : # Find first diff first_diff_idx = None for idx , val in enumerate ( a ) : if val != b [ idx ] : first_diff_idx = idx break if first_diff_idx == None : # No difference return None # Diff to first line of diff plus some lines context = 3 diff = difflib . unified_diff ( a [ : first_diff_idx + context ] , b [ : first_diff_idx + context ] , fromfile , tofile ) difference = "\n" . join ( diff ) if first_diff_idx + context < len ( a ) : difference += "\n*** Diff truncated ***" return difference