René's URL Explorer Experiment


Title: Are non-reified docstrings acceptable? · gitpython-developers/GitPython · Discussion #1734 · GitHub

Open Graph Title: Are non-reified docstrings acceptable? · gitpython-developers/GitPython · Discussion #1734

X Title: Are non-reified docstrings acceptable? · gitpython-developers/GitPython · Discussion #1734

Description: Are non-reified docstrings acceptable?

Open Graph Description: Unlike modules, classes, and functions/methods, variables/constants do not technically support docstrings. However, it is fairly common to write what is conceptually a docstring immediately after a...

X Description: Unlike modules, classes, and functions/methods, variables/constants do not technically support docstrings. However, it is fairly common to write what is conceptually a docstring immediately after a...

Opengraph URL: https://github.com/gitpython-developers/GitPython/discussions/1734

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Are non-reified docstrings acceptable?","text":"

Unlike modules, classes, and functions/methods, variables/constants do not technically support docstrings. However, it is fairly common to write what is conceptually a docstring immediately after an assignment statement, as an expression statement consisting of a triple-quoted string, with no blank line in between. This is recognized by some editors, including VS Code, as a docstring, and helpfully displayed when one hovers over or otherwise examines information on the variable/constant it documents. Of course, calling help on the variable/constant does not reveal it; while true docstrings become __doc__ attributes, this informal kind of docstring cannot and does not affect an object's __doc__ attribute at runtime. (It is reflected in the AST, because it is a statement, but it is non-reified in the sense that, unlike true docstrings, it has no place in the data model.)

\n

I think it would be useful to convert some comments atop variable/constant assignment statements to this kind of \"docstring\", and perhaps to add them for some variables/constants that currently are not directly documented. But I wanted to check, since it may be that for this project only true docstrings are preferred.

\n

As an example of this, here's one change that could be made in test_util.py:

\n
-# Mapping of expected failures for the test_cygpath_ok test.\n _cygpath_ok_xfails = {\n     # From _norm_cygpath_pairs:\n     (R\"C:\\Users\", \"/cygdrive/c/Users\"): \"/proc/cygdrive/c/Users\",\n     (R\"C:\\d/e\", \"/cygdrive/c/d/e\"): \"/proc/cygdrive/c/d/e\",\n     (\"C:\\\\\", \"/cygdrive/c/\"): \"/proc/cygdrive/c/\",\n     (R\"\\\\server\\BAR/\", \"//server/BAR/\"): \"//server/BAR\",\n     (R\"D:/Apps\", \"/cygdrive/d/Apps\"): \"/proc/cygdrive/d/Apps\",\n     (R\"D:/Apps\\fOO\", \"/cygdrive/d/Apps/fOO\"): \"/proc/cygdrive/d/Apps/fOO\",\n     (R\"D:\\Apps/123\", \"/cygdrive/d/Apps/123\"): \"/proc/cygdrive/d/Apps/123\",\n     # From _unc_cygpath_pairs:\n     (R\"\\\\?\\a:\\com\", \"/cygdrive/a/com\"): \"/proc/cygdrive/a/com\",\n     (R\"\\\\?\\a:/com\", \"/cygdrive/a/com\"): \"/proc/cygdrive/a/com\",\n }\n+\"\"\"Mapping of expected failures for the test_cygpath_ok test.\"\"\"
\n

(Ordinarily I might just open a PR, which could be merged or not. But exactly where I'd add these depends on decisions related to other PRs: at least #1732, and possibly also a forthcoming PR that builds on #1729. So I figured I'd post this question instead.)

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Thanks for bringing this up!

\n

I think GitPython should try to provide a decent in-editor experience, and this seems to be improved by turning these comments on constants into non-reified docstrings. This would also be a guiding principle - there are no rules except for \"don't break anyone\" and \"don't make it worse more than you make it better\" :).

","upvoteCount":2,"url":"https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:4be0bc2f-8a51-fdb7-ae5c-aacea74a5a5a
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-id9BF2:25046C:1869CB:229AA0:6968B76A
html-safe-noncedc339c600e06a9b19140a47ea189ea96459c13669f5d4f0372c0537d50a1e579
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkYyOjI1MDQ2QzoxODY5Q0I6MjI5QUEwOjY5NjhCNzZBIiwidmlzaXRvcl9pZCI6IjE0NzQyODk0MzY0MTEzNDQ3NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacfea5c7a9c371042f719c6d087a7df887b23501d209b04188865c57f60a151842
hovercard-subject-tagdiscussion:5812445
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/gitpython-developers/GitPython/1734/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/721bb20bd628efd5539c0574ce3bc862e863141b5f80d22503923f3ac170d8a2/gitpython-developers/GitPython/discussions/1734
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/721bb20bd628efd5539c0574ce3bc862e863141b5f80d22503923f3ac170d8a2/gitpython-developers/GitPython/discussions/1734
og:image:altUnlike modules, classes, and functions/methods, variables/constants do not technically support docstrings. However, it is fairly common to write what is conceptually a docstring immediately after a...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefdc7c66bd36a6c12eb8e771e806db863266e573fc299e77f27505a768d4f8a98
turbo-cache-controlno-preview
go-importgithub.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126087
octolytics-dimension-repository_nwogitpython-developers/GitPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126087
octolytics-dimension-repository_network_root_nwogitpython-developers/GitPython
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
release3223a6503d318917691422cdadfbe16cd8fb21e5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/GitPython/discussions/1734#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fdiscussions%2F1734
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%2Fgitpython-developers%2FGitPython%2Fdiscussions%2F1734
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%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=gitpython-developers%2FGitPython
Reloadhttps://github.com/gitpython-developers/GitPython/discussions/1734
Reloadhttps://github.com/gitpython-developers/GitPython/discussions/1734
Reloadhttps://github.com/gitpython-developers/GitPython/discussions/1734
gitpython-developers https://github.com/gitpython-developers
GitPythonhttps://github.com/gitpython-developers/GitPython
Please reload this pagehttps://github.com/gitpython-developers/GitPython/discussions/1734
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 964 https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5k https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://github.com/gitpython-developers/GitPython
Issues 169 https://github.com/gitpython-developers/GitPython/issues
Pull requests 8 https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/gitpython-developers/GitPython/security
Please reload this pagehttps://github.com/gitpython-developers/GitPython/discussions/1734
Insights https://github.com/gitpython-developers/GitPython/pulse
Code https://github.com/gitpython-developers/GitPython
Issues https://github.com/gitpython-developers/GitPython/issues
Pull requests https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Answered https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116
Byronhttps://github.com/Byron
EliahKagan https://github.com/EliahKagan
Q&Ahttps://github.com/gitpython-developers/GitPython/discussions/categories/q-a
Are non-reified docstrings acceptable? https://github.com/gitpython-developers/GitPython/discussions/1734#top
EliahKagan https://github.com/EliahKagan
Answered https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116
Byronhttps://github.com/Byron
Return to tophttps://github.com/gitpython-developers/GitPython/discussions/1734#top
Please reload this pagehttps://github.com/gitpython-developers/GitPython/discussions/1734
https://github.com/gitpython-developers/GitPython/discussions/1734
EliahKagan https://github.com/EliahKagan
Nov 4, 2023 https://github.com/gitpython-developers/GitPython/discussions/1734#discussion-5812445
in test_util.pyhttps://github.com/gitpython-developers/GitPython/blob/d5fc6e5337011d54fd2f3ff5aac71dbb38e43ee6/test/test_util.py#L237-L250
#1732https://github.com/gitpython-developers/GitPython/pull/1732
#1729https://github.com/gitpython-developers/GitPython/pull/1729
Give feedback.https://github.com/gitpython-developers/GitPython/discussions/1734
Byron https://github.com/Byron
Nov 6, 2023 https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116
View full answer https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116
Oldest https://github.com/gitpython-developers/GitPython/discussions/1734?sort=old
Newest https://github.com/gitpython-developers/GitPython/discussions/1734?sort=new
Top https://github.com/gitpython-developers/GitPython/discussions/1734?sort=top
Please reload this pagehttps://github.com/gitpython-developers/GitPython/discussions/1734
https://github.com/gitpython-developers/GitPython/discussions/1734
Byron https://github.com/Byron
Nov 6, 2023 https://github.com/gitpython-developers/GitPython/discussions/1734#discussioncomment-7484116
Give feedback.https://github.com/gitpython-developers/GitPython/discussions/1734
Byronhttps://github.com/Byron
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fdiscussions%2F1734
🙏 Q&A https://github.com/gitpython-developers/GitPython/discussions/categories/q-a
https://github.com/EliahKagan
https://github.com/Byron
https://github.com/gitpython-developers/GitPython/discussions/1734
https://github.com/settings/replies?return_to=1
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.