René's URL Explorer Experiment


Title: GH-98363: Have batched() return tuples by rhettinger · Pull Request #100118 · python/cpython · GitHub

Open Graph Title: GH-98363: Have batched() return tuples by rhettinger · Pull Request #100118 · python/cpython

X Title: GH-98363: Have batched() return tuples by rhettinger · Pull Request #100118 · python/cpython

Description: On python-ideas, I got some pushback on the decision to return lists. After rereading the original thread and looking at the use cases with fresh eyes, it looks like tuples are a marginally better choice. Using a tuple better matches tools like enumerate, zip, zip_longest, pairwise, and the combinatoric iterators. Tuples are better suited for cases where use hashing is desired. And tuples will be a better fit if we ever add zip_longest style fillvalue support. The notion that people might want to mutate the result proved to be dubious. A quick code search for more-iterools.chunked() turned-up no examples. If the need did arise, a list comprehension would likely be better than being tempted to mutate in place. Mostly this is a usability/consistency decision, but there are slight performance benefits as well. Tuples have the data in the tuple object rather than in a separate data array. So tuples require only one memory allocation instead of two. Tuples use less memory than lists (two fewer fields and no losses due to data array alignment). Lookups are slightly faster because lists have one additional indirection step. Also, tuples have better cache performance — their unibody design lets them fit into a single cache line rather than two for lists. Issue: gh-98363

Open Graph Description: On python-ideas, I got some pushback on the decision to return lists. After rereading the original thread and looking at the use cases with fresh eyes, it looks like tuples are a marginally better...

X Description: On python-ideas, I got some pushback on the decision to return lists. After rereading the original thread and looking at the use cases with fresh eyes, it looks like tuples are a marginally better...

Opengraph URL: https://github.com/python/cpython/pull/100118

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:dd02739c-a59e-8f74-a9b6-6b0ae892d2d9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id91A4:FC316:1B24EAD:23F420C:696AF3F3
html-safe-nonce4aeb5f806621cc428e9dbab547e11b1a00f96369e4e80eafecf027a3ef41eae7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUE0OkZDMzE2OjFCMjRFQUQ6MjNGNDIwQzo2OTZBRjNGMyIsInZpc2l0b3JfaWQiOiI4MzQzNDMwMjc1ODY5MTExMjgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac801ebfd4105b104572fdc0a8e4917bfb6caa5ad3115503be88155fe12e93a6cd
hovercard-subject-tagpull_request:1154713985
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/100118/files
twitter:imagehttps://avatars.githubusercontent.com/u/1623689?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1623689?s=400&v=4
og:image:altOn python-ideas, I got some pushback on the decision to return lists. After rereading the original thread and looking at the use cases with fresh eyes, it looks like tuples are a marginally better...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/100118/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F100118%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F100118%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/100118/files
Reloadhttps://github.com/python/cpython/pull/100118/files
Reloadhttps://github.com/python/cpython/pull/100118/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
rhettingerhttps://github.com/rhettinger
python:mainhttps://github.com/python/cpython/tree/main
rhettinger:batched_tuplehttps://github.com/rhettinger/cpython/tree/batched_tuple
Conversation 6 https://github.com/python/cpython/pull/100118
Commits 6 https://github.com/python/cpython/pull/100118/commits
Checks 0 https://github.com/python/cpython/pull/100118/checks
Files changed https://github.com/python/cpython/pull/100118/files
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
GH-98363: Have batched() return tuples https://github.com/python/cpython/pull/100118/files#top
Show all changes 6 commits https://github.com/python/cpython/pull/100118/files
62af1ed Have batched() return tuples instead of lists rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/62af1ed306b87f884bf6a4b8a974568cd52b68b1
8089281 Update clinic rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/8089281625b341380f1982977f1aed4f05e5cfb1
717e1e3 Comment and docstring tweaks rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/717e1e3d0025826aabdfd5982a06fbeb57676f52
cd04a33 . rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/cd04a337b2833b0554cf578aa172614380ba7d77
daf4f16 . rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/daf4f164defbda0dceba3cbecb7ef62573179fbc
fdc644d Update summary table at the top of the docs rhettinger Dec 8, 2022 https://github.com/python/cpython/pull/100118/commits/fdc644d08011f3777aa08c171efa6f42208d8e0b
Clear filters https://github.com/python/cpython/pull/100118/files
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
itertools.rst https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
test_itertools.py https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
itertoolsmodule.c.h https://github.com/python/cpython/pull/100118/files#diff-1628d1649ee211a1608915194dc2bdb99f3c8db7e7e652445febe496a5b52184
itertoolsmodule.c https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L508
Doc/library/itertools.rsthttps://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
View file https://github.com/rhettinger/cpython/blob/fdc644d08011f3777aa08c171efa6f42208d8e0b/Doc/library/itertools.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/100118/{{ revealButtonHref }}
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/pull/100118/files#diff-dc4aad2e6d83f79bb1296aa5b1e1567f11ef347d522c2eb3a82645f772cd6e5e
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L509
Lib/test/test_itertools.pyhttps://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
View file https://github.com/rhettinger/cpython/blob/fdc644d08011f3777aa08c171efa6f42208d8e0b/Lib/test/test_itertools.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/100118/{{ revealButtonHref }}
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
https://github.com/python/cpython/pull/100118/files#diff-9abbaeca99112e9e04b554726bff97b76030eb982f39e591be77be8ef14149e5
Modules/clinic/itertoolsmodule.c.hhttps://github.com/python/cpython/pull/100118/files#diff-1628d1649ee211a1608915194dc2bdb99f3c8db7e7e652445febe496a5b52184
View file https://github.com/rhettinger/cpython/blob/fdc644d08011f3777aa08c171efa6f42208d8e0b/Modules/clinic/itertoolsmodule.c.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/100118/files
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L510
Modules/itertoolsmodule.chttps://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
View file https://github.com/rhettinger/cpython/blob/fdc644d08011f3777aa08c171efa6f42208d8e0b/Modules/itertoolsmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/100118/{{ revealButtonHref }}
https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com/python/cpython/pull/100118/files#diff-dc27cbdf2b9f6e5236cade13cf301d352a7abd2a8b1988f2517d6f5b7a30c201
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.