Как оптимальнее преобразовать список:
=> ?
task = self.config[taskName]
sourceText = [(os.path.splitext(os.path.basename(file))[0],
open(file, 'r', encoding=task['Source encoding']).read())
for file in glob.glob(task['Source files'])]
# Возможно, нужно улучшить...
separator = task['Split'] if 'Split' in task.keys() else None
if separator:
s = []
for file, text in sourceText:
s.extend([(file, t) for t in text.split(separator)])
sourceText = s
# ----------