Skip to content

gh-119793: Add optional length-checking to map() - #120471

Merged
encukou merged 45 commits into
python:mainfrom
nineteendo:strict-map
Nov 4, 2024
Merged

gh-119793: Add optional length-checking to map()#120471
encukou merged 45 commits into
python:mainfrom
nineteendo:strict-map

Conversation

@nineteendo

@nineteendonineteendo commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

These two examples silently truncate the unmatched inputs:

>>>list(map(pow, [1, 2, 3], [2, 2, 2, 2]))
[1, 4, 9]
>>>list(map(pow, [1, 2, 3, 4, 5], [2, 2, 2, 2]))
[1, 4, 9, 16]

📚 Documentation preview 📚: library/functions.html#map

Comment threadLib/test/test_itertools.py
@nineteendo
nineteendo marked this pull request as ready for review June 13, 2024 19:45
Comment threadLib/test/test_builtin.py Outdated
Comment threadPython/bltinmodule.c
Comment threadDoc/library/functions.rst Outdated
Comment threadDoc/library/functions.rst Outdated
Comment threadLib/test/test_builtin.py
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c Outdated
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment threadPython/bltinmodule.c
@nineteendo

nineteendo commented Jun 19, 2024

Copy link
Copy Markdown
ContributorAuthor

@rhettinger, thoughts? You requested this. Or do you want someone else to review it?

Comment threadDoc/whatsnew/3.14.rst Outdated
@nineteendo

nineteendo commented Oct 30, 2024

Copy link
Copy Markdown
ContributorAuthor

Thanks Petr, do you know someone besides Brandt and Reymond that might want to review this? I think it would be best to have more than 1 approval.

@encukou

Copy link
Copy Markdown
Member

It would, but if no one finds the time, I plan to merge it next week.

Comment threadPython/bltinmodule.c Outdated
nineteendoand others added 2 commits October 31, 2024 13:19
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Comment threadDoc/whatsnew/3.14.rst Outdated
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c Outdated
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c Outdated
Comment threadPython/bltinmodule.c
nineteendoand others added 5 commits October 31, 2024 15:04
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@nineteendo

nineteendo commented Oct 31, 2024

Copy link
Copy Markdown
ContributorAuthor

Erlend, your remaining suggestions also apply to zip(), as the code was copied. What do you suggest I do?

Comment threadDoc/whatsnew/3.14.rst Outdated
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c Outdated
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c Outdated
Comment threadLib/test/test_builtin.py
Comment threadDoc/library/functions.rst Outdated
Comment threadPython/bltinmodule.c
Comment threadPython/bltinmodule.c
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@erlend-aaslanderlend-aasland changed the title gh-119793: Add Optional Length-Checking To map()gh-119793: Add optional length-checking to map()Nov 1, 2024
@encukou
encukou merged commit 3032fcd into python:mainNov 4, 2024
@nineteendo
nineteendo deleted the strict-map branch November 4, 2024 15:35
picnixz added a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
…0471)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…0471)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@nineteendo@encukou@eendebakpt@rhettinger@picnixz@erlend-aasland