gh-102757: fix function signature mismatch for `functools.reduce` between code and documentation (#102759)