I've coded this function where you read all text file in a directory and you save in a temporary file all values. The text files are x, y and z format. The function returns the name of the temporary filethe bounding boxthe origin (top-left corner)and the bottom (bottom-right corner). I wish for some comments or suggestion on how to improve my working code.import osimport tempfileimport globclass LaserException(Exception):    Laser exception, indicates a laser-related error.    passsepType = {        space: ' ',        tab: '\t',        comma: ',',        colon: ':',        semicolon: ';',        hyphen: '-',        dot: '.'        }def tempfile_merge(path,separator,wildcard= '*.txt'):    file_temp = tempfile.NamedTemporaryFile(delete=False,dir=path)    name = file_temp.name    minx = float('+inf')    maxx = float('-inf')    miny = float('+inf')    maxy = float('-inf')    for file in glob.glob(os.path.join(path,wildcard)):        for line in open(file, r):            element = line.split(sepType[separator])            if len(element) < 3:                raise TypeError(not enough arguments: %s has only %s columns % (inFile_name_suffix,len(element)))            try:                maxx = max(maxx, float(element[0]))                minx = min(minx, float(element[0]))                maxy = max(maxy, float(element[1]))                miny = min(miny, float(element[1]))            except ValueError:                raise LaserException(x,y,z are not float-values)            newelement =  .join([str(e) for e in element])+ \n            file_temp.write(newelement)    file_temp.close()    return(name, ((minx,maxy),(maxx,maxy),(maxx,miny),(minx,miny)),(minx,maxy),(maxx,miny))
Merge all text files in a directory and save a temp file
python;optimization