FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-119793: Prefer `map(..., strict=True)` over starmap/zip in examples by lgeiger · Pull Request #126407 · python/cpython · GitHub

/ cpython Public

gh-119793: Prefer map(..., strict=True) over starmap/zip in examples - #126407

Merged
vstinner merged 1 commit into
python:mainfrom
lgeiger:map-strict-docs
Nov 5, 2024
Merged

gh-119793: Prefer map(..., strict=True) over starmap/zip in examples#126407
vstinner merged 1 commit into
python:mainfrom
lgeiger:map-strict-docs

Conversation

lgeiger commented Nov 4, 2024
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

This is a docs-only change that updates the examples to use map(..., strict=True) instead of starmap(..., zip(..., strict=True)) which should improve readability.


📚 Documentation preview 📚: https://cpython-previews--126407.org.readthedocs.build/

bedevere-app Bot commented Nov 4, 2024

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

terryjreedy added the docs Documentation in the Doc dir label Nov 4, 2024

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

Example:

>>> p=[1,2,3]
>>> q=[4,5,6]
>>> import math
>>> math.sumprod(p, q)
32
>>> import itertools, operator
>>> sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))
32
>>> sum(map(operator.mul, p, q))
32

vstinner merged commit 3d4fda2 into python:main Nov 5, 2024
lgeiger deleted the map-strict-docs branch November 5, 2024 09:57
picnixz pushed a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL