Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Nov 4, 2024

Conversation

nineteendo
Copy link
Contributor

@nineteendo nineteendo commented Jun 13, 2024

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

@nineteendo nineteendo marked this pull request as ready for review June 13, 2024 19:45
@nineteendo
Copy link
Contributor Author

nineteendo commented Jun 19, 2024

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

@nineteendo
Copy link
Contributor Author

nineteendo commented Oct 30, 2024

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
Member

encukou commented Oct 31, 2024

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

nineteendo and others added 2 commits October 31, 2024 13:19
@nineteendo
Copy link
Contributor Author

nineteendo commented Oct 31, 2024

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

Co-authored-by: Erlend E. Aasland <[email protected]>
@erlend-aasland erlend-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:main Nov 4, 2024
39 checks passed
@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 <[email protected]>
Co-authored-by: Pieter Eendebak <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Raymond Hettinger <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…0471)


Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Pieter Eendebak <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Raymond Hettinger <[email protected]>
Sign up for free to 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