default list of files from () to None, and explicitly test for None
before defaulting to sys.argv[1:]. This means that if you pass in an
explicit empty list, it will read stdin instead of defaulting to
sys.argv[1:]. This fixes a buglet in the test script (when called
with options but without files, it chokes when it tries to interpret
the options as files).
Lawrence adds: "I suspect that this is a safe change, because I can't
imagine someone actively passing in an empty list when they want
sys.argv used."
I agree.
the writing of filters.
Typical use is:
import fileinput
for line in fileinput.input():
process(line)
This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty or when a filename is
'-'.
There is also an option to use this to direct the output back to the
input files.