Repository navigation
Remove kw parameters from python version of functools.reduce #149537
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
It was scheduled to be removed in 3.16:
Lines 1182 to 1208 in 4ae1a26
| def _warn_python_reduce_kwargs(py_reduce): | |
| @wraps(py_reduce) | |
| def wrapper(*args, **kwargs): | |
| if 'function' in kwargs or 'sequence' in kwargs: | |
| import os | |
| import warnings | |
| warnings.warn( | |
| 'Calling functools.reduce with keyword arguments ' | |
| '"function" or "sequence" ' | |
| 'is deprecated in Python 3.14 and will be ' | |
| 'forbidden in Python 3.16.', | |
| DeprecationWarning, | |
| skip_file_prefixes=(os.path.dirname(__file__),)) | |
| return py_reduce(*args, **kwargs) | |
| return wrapper | |
| reduce = _warn_python_reduce_kwargs(reduce) | |
| del _warn_python_reduce_kwargs | |
| # The import of the C accelerated version of reduce() has been moved | |
| # here due to gh-121676. In Python 3.16, _warn_python_reduce_kwargs() | |
| # should be removed and the import block should be moved back right | |
| # after the definition of reduce(). | |
| try: | |
| from _functools import reduce | |
| except ImportError: | |
| pass |
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
gh-149537: Remove kw parameters from python version of `reduce` (#149538