René's URL Explorer Experiment


Title: Invalid "equivalents" of the complex type constructor in docs · Issue #109218 · python/cpython · GitHub

Open Graph Title: Invalid "equivalents" of the complex type constructor in docs · Issue #109218 · python/cpython

X Title: Invalid "equivalents" of the complex type constructor in docs · Issue #109218 · python/cpython

Description: The sphinx docs says: class complex(real=0, imag=0) [...] Return a complex number with the value real + imag*1j or convert a string or number to a complex number. [...] The docstring (btw it doesn't mention a string as an argument): >>> ...

Open Graph Description: The sphinx docs says: class complex(real=0, imag=0) [...] Return a complex number with the value real + imag*1j or convert a string or number to a complex number. [...] The docstring (btw it doesn'...

X Description: The sphinx docs says: class complex(real=0, imag=0) [...] Return a complex number with the value real + imag*1j or convert a string or number to a complex number. [...] The docstring (btw it doesn&...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid \"equivalents\" of the complex type constructor in docs","articleBody":"The sphinx docs says:\r\n```\r\nclass complex(real=0, imag=0)\r\n[...]\r\nReturn a complex number with the value real + imag*1j or convert a string or number to a complex number.\r\n[...]\r\n```\r\nThe docstring (btw it doesn't mention a string as an argument):\r\n```\r\n\u003e\u003e\u003e print(complex.__doc__)\r\nCreate a complex number from a real part and an optional imaginary part.\r\n\r\nThis is equivalent to (real + imag*1j) where imag defaults to 0.\r\n```\r\n\r\nThat wrong, e.g.:\r\n```pycon\r\n\u003e\u003e\u003e complex(0.0, -0.0)\r\n-0j\r\n\u003e\u003e\u003e 0.0 + (-0.0)*1j\r\n0j\r\n\u003e\u003e\u003e complex(-0.0, -0.0)\r\n(-0-0j)\r\n\u003e\u003e\u003e -0.0 + (-0.0)*1j\r\n(-0+0j)\r\n\u003e\u003e\u003e complex(-0.0, 0.0)\r\n(-0+0j)\r\n\u003e\u003e\u003e -0.0 + 0.0*1j\r\n0j\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eHere is an attempt (patch) to solve, let me know if this is worth a PR:\u003c/summary\u003e\r\n\r\n```diff\r\ndiff --git a/Doc/library/functions.rst b/Doc/library/functions.rst\r\nindex d9974c6350..78b85658ef 100644\r\n--- a/Doc/library/functions.rst\r\n+++ b/Doc/library/functions.rst\r\n@@ -373,8 +373,8 @@ are always available.  They are listed here in alphabetical order.\r\n .. class:: complex(real=0, imag=0)\r\n            complex(string)\r\n\r\n-   Return a complex number with the value *real* + *imag*\\*1j or convert a string\r\n-   or number to a complex number.  If the first parameter is a string, it will\r\n+   Create a complex number from a real part and an optional imaginary part\r\n+   or convert a string to a complex number.  If the first parameter is a string, it will\r\n    be interpreted as a complex number and the function must be called without a\r\n    second parameter.  The second parameter can never be a string. Each argument\r\n    may be any numeric type (including complex).  If *imag* is omitted, it\r\ndiff --git a/Objects/complexobject.c b/Objects/complexobject.c\r\nindex 0e96f54584..336b703233 100644\r\n--- a/Objects/complexobject.c\r\n+++ b/Objects/complexobject.c\r\n@@ -886,9 +886,8 @@ complex.__new__ as complex_new\r\n     real as r: object(c_default=\"NULL\") = 0\r\n     imag as i: object(c_default=\"NULL\") = 0\r\n\r\n-Create a complex number from a real part and an optional imaginary part.\r\n-\r\n-This is equivalent to (real + imag*1j) where imag defaults to 0.\r\n+Create a complex number from a real part and an optional imaginary part\r\n+or convert a string to a complex number.\r\n [clinic start generated code]*/\r\n\r\n static PyObject *\r\n```\r\n\u003c/details\u003e\r\n\r\n**Edit**:\r\nAnother instance of this issue is in the [cmath docs](https://docs.python.org/3/library/cmath.html#conversions-to-and-from-polar-coordinates):\r\n```rst\r\nA Python complex number ``z`` is stored internally using *rectangular*\r\nor *Cartesian* coordinates.  It is completely determined by its *real\r\npart* ``z.real`` and its *imaginary part* ``z.imag``.  In other\r\nwords::\r\n\r\n   z == z.real + z.imag*1j\r\n```\r\nE.g.:\r\n```pycon\r\n\u003e\u003e\u003e from cmath import inf\r\n\u003e\u003e\u003e complex(0.0, inf)\r\ninfj\r\n\u003e\u003e\u003e 0.0 + inf*1j\r\n(nan+infj)\r\n```\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-119620\n* gh-119635\n* gh-119687\n* gh-119795\n* gh-119796\n* gh-119803\n* gh-119805\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/skirpichev","@type":"Person","name":"skirpichev"},"datePublished":"2023-09-10T08:47:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/109218/cpython/issues/109218"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:073e162a-5518-d009-add0-562d8c0fa6fe
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB0F4:3410DA:2BC96A2:391E688:696B73A8
html-safe-nonce5ea4ad4a9c262e5bc49966c2e29df1a39603893da4881b0c919ae3fedd200d1a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEY0OjM0MTBEQToyQkM5NkEyOjM5MUU2ODg6Njk2QjczQTgiLCJ2aXNpdG9yX2lkIjoiODg5ODA0NDYyNTQ4MTg1NTkxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac32582e596bf7283d95f5b459ce36409754ac216a3fa84832594829a8c59cd477
hovercard-subject-tagissue:1889054796
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/109218/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6c9d2775269bb70c6d56bdf38f2771ca20d6c8d03a3659d40e0356e1a16cfb62/python/cpython/issues/109218
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6c9d2775269bb70c6d56bdf38f2771ca20d6c8d03a3659d40e0356e1a16cfb62/python/cpython/issues/109218
og:image:altThe sphinx docs says: class complex(real=0, imag=0) [...] Return a complex number with the value real + imag*1j or convert a string or number to a complex number. [...] The docstring (btw it doesn'...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameskirpichev
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
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
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/109218#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F109218
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%2Fissues%2F109218
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/109218
Reloadhttps://github.com/python/cpython/issues/109218
Reloadhttps://github.com/python/cpython/issues/109218
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/109218
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/issues/109218
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
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/109218
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/109218
Invalid "equivalents" of the complex type constructor in docshttps://github.com/python/cpython/issues/109218#top
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%22
https://github.com/skirpichev
https://github.com/skirpichev
skirpichevhttps://github.com/skirpichev
on Sep 10, 2023https://github.com/python/cpython/issues/109218#issue-1889054796
cmath docshttps://docs.python.org/3/library/cmath.html#conversions-to-and-from-polar-coordinates
gh-109218: Deprecate weird cases in the complex() constructor #119620https://github.com/python/cpython/pull/119620
gh-109218: Refactor tests for the complex() constructor #119635https://github.com/python/cpython/pull/119635
gh-109218: Improve documentation for the complex() constructor #119687https://github.com/python/cpython/pull/119687
[3.13] gh-109218: Refactor tests for the complex() constructor (GH-119635) #119795https://github.com/python/cpython/pull/119795
[3.12] gh-109218: Refactor tests for the complex() constructor (GH-119635) #119796https://github.com/python/cpython/pull/119796
[3.13] gh-109218: Improve documentation for the complex() constructor (GH-119687) #119803https://github.com/python/cpython/pull/119803
[3.12] gh-109218: Improve documentation for the complex() constructor (GH-119687) #119805https://github.com/python/cpython/pull/119805
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%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.