Skip to content

Function signature mismatch for functools.reduce between C implementation, Python implementation, and online documentaion #102757

Closed
@XuehaiPan

Description

@XuehaiPan

Documentation

(A clear and concise description of the issue.)

The function signature mismatch for functools.reduce:

  • C implementation:

    _initial_missing = object()
    
    @overload
    def reduce(function, iterable, /): ...
    @overload
    def reduce(function, iterable, initial=_initial_missing, /): ...
  • Python implementation:

    _initial_missing = object()
    
    @overload
    def reduce(function, sequence): ...
    @overload
    def reduce(function, sequence, initial=_initial_missing): ...

Argument change: iterable -> sequence.

  • Online documentation:

    def reduce(function, iterable, initializer=None): ...

Argument change: initial -> initializer.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions