René's URL Explorer Experiment


Title: Increase `PyStructSequence` compatibility with `collections.namedtuple` · Issue #108647 · python/cpython · GitHub

Open Graph Title: Increase `PyStructSequence` compatibility with `collections.namedtuple` · Issue #108647 · python/cpython

X Title: Increase `PyStructSequence` compatibility with `collections.namedtuple` · Issue #108647 · python/cpython

Description: Feature or enhancement Has this already been discussed elsewhere? This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature: collections.namedtuple provides a couple useful he...

Open Graph Description: Feature or enhancement Has this already been discussed elsewhere? This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature: collection...

X Description: Feature or enhancement Has this already been discussed elsewhere? This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature: collection...

Opengraph URL: https://github.com/python/cpython/issues/108647

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Increase `PyStructSequence` compatibility with `collections.namedtuple` ","articleBody":"# Feature or enhancement\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n`collections.namedtuple` provides a couple useful helper functions, which are not present in `PyStructSequence`, its C API. Even though its documentation does not promise `collections.namedtuple` compatibility, it refers to it as a \"named tuple\".\n\nhttps://github.com/python/cpython/blob/b62a76043e543fbb15cab7e9e8874a798bc600d2/Objects/structseq.c#L4-L7\n\nIMO, it'd be worth to increase compatibility between these two named tuple instances, and also make the extra functionality available in `PyStructSequence`.\n\nMany times already, I have had the need for some of these helpers, with them being unavailable. An example use-case would be converting `sys.version_info` or `sys.flags` to a dictionary.\n\n---\n\nHere's a list of the `collections.namedtuple` helpers that are not available in `PyStructSequence`:\n\n- `_fields`\n  - > Tuple of strings listing the field names. Useful for introspection and for creating new named tuple types from existing named tuples\n- `_asdict`\n  - > Return a new [dict](https://docs.python.org/3/library/stdtypes.html#dict) which maps field names to their corresponding values.\n- `_field_defaults` (would return an empty dict, if implemented)\n  - > Tuple of strings listing the field names. Useful for introspection and for creating new named tuple types from existing named tuples.\n- `_replace`\n  - > Return a new instance of the named tuple replacing specified fields with new values:\n- `_make`\n  - > Class method that makes a new instance from an existing sequence or iterable.\n\n### Proposal:\n\n```python\n>>> import sys\n>>> sys.version_info._fields\n('major', 'minor', 'micro', 'releaselevel', 'serial')\n>>> sys.version_info._asdict()\n{'major': 3, 'minor': 13, 'micro': 0, 'releaselevel': 'alpha', 'serial': 0}\n>>> sys.flags._fields\n('debug', 'inspect', 'interactive', 'optimize', 'dont_write_bytecode', 'no_user_site', 'no_site', 'ignore_environment', 'verbose', 'bytes_warning', 'quiet', 'hash_randomization', 'isolated', 'dev_mode', 'utf8_mode', 'warn_default_encoding', 'safe_path', 'int_max_str_digits')\n>>> sys.flags._asdict()\n{'debug': 0, 'inspect': 0, 'interactive': 0, 'optimize': 0, 'dont_write_bytecode': 0, 'no_user_site': 0, 'no_site': 0, 'ignore_environment': 0, 'verbose': 0, 'bytes_warning': 0, 'quiet': 0, 'hash_randomization': 1, 'isolated': 0, 'dev_mode': False, 'utf8_mode': 0, 'warn_default_encoding': 0, 'safe_path': False, 'int_max_str_digits': 4300}\n```\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-108648\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/FFY00","@type":"Person","name":"FFY00"},"datePublished":"2023-08-29T16:20:10Z","url":"https://github.com/python/cpython/issues/108647"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fd78697f-1e7c-acca-0509-d8a7a56cd730
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD152:19B6A2:1E904D7:2848226:6B0231B0
html-safe-nonceee1eec5e86fa8acf021082d2c282a5be923f3a9a8aa5eca4df1f15365fca4736
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTUyOjE5QjZBMjoxRTkwNEQ3OjI4NDgyMjY6NkIwMjMxQjAiLCJ2aXNpdG9yX2lkIjoiNDk5NzI4OTE5MzM3NDg4ODM2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace4fbaabe76224e2e245d501994d9c8d8ddbcfed00a1ef30edad20ff326ab11e0
hovercard-subject-tagissue:1872007347
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/108647/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a0a380105a9f3b2cee830b3e599dfff139d3aa3165bfab2fcab2b2dd4b005efd/python/cpython/issues/108647
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a0a380105a9f3b2cee830b3e599dfff139d3aa3165bfab2fcab2b2dd4b005efd/python/cpython/issues/108647
og:image:altFeature or enhancement Has this already been discussed elsewhere? This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature: collection...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameFFY00
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/108647#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F108647
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F108647
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/108647
Reloadhttps://github.com/python/cpython/issues/108647
Reloadhttps://github.com/python/cpython/issues/108647
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/108647
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/108647
Increase PyStructSequence compatibility with collections.namedtuple https://github.com/python/cpython/issues/108647#top
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/FFY00
FFY00https://github.com/FFY00
on Aug 29, 2023https://github.com/python/cpython/issues/108647#issue-1872007347
cpython/Objects/structseq.chttps://github.com/python/cpython/blob/b62a76043e543fbb15cab7e9e8874a798bc600d2/Objects/structseq.c#L4-L7
b62a760https://github.com/python/cpython/commit/b62a76043e543fbb15cab7e9e8874a798bc600d2
dicthttps://docs.python.org/3/library/stdtypes.html#dict
GH-46145: make PyStructSequence compatible with namedtuple #108648https://github.com/python/cpython/pull/108648
FFY00https://github.com/FFY00
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Aug 29, 2023https://github.com/python/cpython/issues/108647#event-10223388239
https://github.com/ericvsmith
ericvsmithhttps://github.com/ericvsmith
on Aug 29, 2023https://github.com/python/cpython/issues/108647#issuecomment-1698143769
https://github.com/FFY00
FFY00https://github.com/FFY00
on Aug 29, 2023https://github.com/python/cpython/issues/108647#issuecomment-1698238326
https://github.com/FFY00
FFY00https://github.com/FFY00
on Aug 30, 2023https://github.com/python/cpython/issues/108647#issuecomment-1699113300
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 30, 2023https://github.com/python/cpython/issues/108647#issuecomment-1699188622
#46145https://github.com/python/cpython/issues/46145
https://github.com/ericvsmith
ericvsmithhttps://github.com/ericvsmith
on Aug 30, 2023https://github.com/python/cpython/issues/108647#issuecomment-1699266826
https://github.com/FFY00
FFY00https://github.com/FFY00
on Sep 1, 2023https://github.com/python/cpython/issues/108647#issuecomment-1702115955
#46145https://github.com/python/cpython/issues/46145
FFY00https://github.com/FFY00
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 1, 2023https://github.com/python/cpython/issues/108647#event-10252659574
https://github.com/AA-Turner
AA-Turnerhttps://github.com/AA-Turner
on Sep 1, 2023https://github.com/python/cpython/issues/108647#issuecomment-1702208628
AA-Turnerhttps://github.com/AA-Turner
not plannedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Sep 1, 2023https://github.com/python/cpython/issues/108647#event-10253448353
FFY00https://github.com/FFY00
on Nov 17, 2024https://github.com/python/cpython/issues/108647#event-15323514552
Merge branch 'main' into pythongh-108647https://github.com/FFY00/cpython/commit/1a4d1f30ce8e13fe6673533edf35a7110b2c652e
pythongh-108647https://github.com/python/cpython/issues/108647
1a4d1f3https://github.com/FFY00/cpython/commit/1a4d1f30ce8e13fe6673533edf35a7110b2c652e
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/108647
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/108647
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
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.