You can use the write method of any file object opened for write or append. You might need to write a wrapper function if you want print-like behavior. Your example should work fine unwrapped, something like (untested) this with sys.stdout:
import sys
from functools import reduce
with open("test.py") as f:
reduce(sys.stdout.write, (line for line in f))
The function print() has side-effects (writes text to a stream) so it is not something you should use in functional style. See my recent post:
reduce(function, iterable) calls the function with two arguments: the previous return value of the function and an item from the iterable.[1]None you see are the return values of the previous print() calls.
You are not “redirecting” the output. You are calling something like: