Content-Length: 269146 | pFad | https://github.com/python/cpython/issues/102757

C9 Function signature mismatch for `functools.reduce` between C implementation, Python implementation, and online documentaion · Issue #102757 · python/cpython · GitHub
Skip to content

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

@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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/102757

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy