On 2015-12-04, Oscar Benjamin wrote: > Or you can use fileinput which is designed to be exactly this kind of > context manager and to be used in this way. Although fileinput is slightly > awkward in defaulting to reading stdin.
That default is what I specifically like about fileinput --- it's a normal way for command-line tools to work: $ sort file0 file1 file2 >sorted.txt $ generate_junk | sort >sorted_junk.txt -- $2.95! PLATE O' SHRIMP Luncheon Special -- https://mail.python.org/mailman/listinfo/python-list