I have a function that checks for file and directory changes within a given function and returns a tuple of lists, like this: addedFiles, removedFiles, addedDirs, removedDirs. Each of the named sublists in the tuple will be a list of strings (or empty). I need to append the results return by the function to local versions of these lists.
This heavily modified demonstrates the result I am after:
addedFiles, removedFiles, addedDirs, removedDirs = [],[],[],[]
for dir in allDirs:
a,b,c,d = scanDir( dir )
addedFiles.extend( a )
removedFiles.extend( b )
addedDirs.extend( c )
removedDirs.extend( d )
But, I want to know if there is a better way to perform the section inside the for loop?
Like this it just feels a bit … ugly.
How about: