René's URL Explorer Experiment


Title: Inconsistencies between documentation/annotations and behavior · Issue #28 · python-humanize/humanize · GitHub

Open Graph Title: Inconsistencies between documentation/annotations and behavior · Issue #28 · python-humanize/humanize

X Title: Inconsistencies between documentation/annotations and behavior · Issue #28 · python-humanize/humanize

Description: naturaltime() supports timedelta. It is not documented, but humanize.naturaltime() accepts timedelta. I used it for years until type annotations were added, and MyPy started to complain. timedelta is still accepted at runtime. >>> import...

Open Graph Description: naturaltime() supports timedelta. It is not documented, but humanize.naturaltime() accepts timedelta. I used it for years until type annotations were added, and MyPy started to complain. timedelta ...

X Description: naturaltime() supports timedelta. It is not documented, but humanize.naturaltime() accepts timedelta. I used it for years until type annotations were added, and MyPy started to complain. timedelta ...

Opengraph URL: https://github.com/python-humanize/humanize/issues/28

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistencies between documentation/annotations and behavior","articleBody":"## `naturaltime()` supports `timedelta`.\r\n\r\nIt is not documented, but `humanize.naturaltime()` accepts `timedelta`. I used it for years until type annotations were added, and MyPy started to complain. `timedelta` is still accepted at runtime.\r\n\r\n```pycon\r\n\u003e\u003e\u003e import datetime, humanize\r\n\u003e\u003e\u003e humanize.naturaltime(datetime.timedelta(days=5, hours=3))\r\n'5 days ago'\r\n\u003e\u003e\u003e humanize.naturaltime(datetime.timedelta(hours=123))\r\n'5 days ago'\r\n```\r\n\r\nI expect one of two things:\r\n\r\n1. Document that `humanize.naturaltime()` accepts `timedelta`, not only `datetime | int` and update type annotation.\r\n2. Make `humanize.naturaltime()` rejecting `timedelta` (of course, after some deprecation period).\r\n\r\nOption 1 is more compatible, but option 2 looks more logical.\r\n\r\n## `naturaltime()` and `naturaldelta()` accept not only `int`, but `float` too.\r\n\r\n```pycon\r\n\u003e\u003e\u003e humanize.naturaltime(23.5)\r\n'23 seconds ago'\r\n\u003e\u003e\u003e humanize.naturaldelta(23.5)\r\n'23 seconds'\r\n```\r\n\r\nIt is expected, since timestamp in Python is `float`, but it should be documented, and annotations should be updated.\r\n\r\n## `naturaltime()`, `naturaldelta()` , `naturaldate()` and `naturalday()` accept arbitrary object without error.\r\n\r\n```pycon\r\n\u003e\u003e\u003e humanize.naturaltime([1, 2, 3])\r\n'[1, 2, 3]'\r\n\u003e\u003e\u003e humanize.naturaldelta([1, 2, 3])\r\n'[1, 2, 3]'\r\n\u003e\u003e\u003e humanize.naturaldate([1, 2, 3])\r\n'[1, 2, 3]'\r\n\u003e\u003e\u003e humanize.naturalday([1, 2, 3])\r\n'[1, 2, 3]'\r\n```\r\n\r\nIt is unsafe, because allows programming errors to slip unnoticed. `humanize.naturalsize()` raises an error, as expected.\r\n\r\nHumanize 4.2.1\r\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2022-06-24T16:49:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/28/humanize/issues/28"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:eee5198c-d172-50d0-7d4f-ebf185e0b8ce
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD286:DD10E:61F3:8469:6A558346
html-safe-noncea71713bd5f117dc471e5159dc0676c3d288b484b1f69aa2e58a872425f04a9ff
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjg2OkREMTBFOjYxRjM6ODQ2OTo2QTU1ODM0NiIsInZpc2l0b3JfaWQiOiIxNzc4MzgzMzM4NzEwODYwNjE0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf72297f395f21fa197d2ca6cc07853008c63ffdebb97efce401e0d62bf27a9ea
hovercard-subject-tagissue:1283965745
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-humanize/humanize/28/issue_layout
twitter:imagehttps://opengraph.githubassets.com/108309bd4dc6a2c7c41a1a85fc34610451d74026227a7ce3d0a9be9a291595a7/python-humanize/humanize/issues/28
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/108309bd4dc6a2c7c41a1a85fc34610451d74026227a7ce3d0a9be9a291595a7/python-humanize/humanize/issues/28
og:image:altnaturaltime() supports timedelta. It is not documented, but humanize.naturaltime() accepts timedelta. I used it for years until type annotations were added, and MyPy started to complain. timedelta ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameserhiy-storchaka
hostnamegithub.com
expected-hostnamegithub.com
Noneb5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e
turbo-cache-controlno-preview
go-importgithub.com/python-humanize/humanize git https://github.com/python-humanize/humanize.git
octolytics-dimension-user_id62149795
octolytics-dimension-user_loginpython-humanize
octolytics-dimension-repository_id466683324
octolytics-dimension-repository_nwopython-humanize/humanize
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id466683324
octolytics-dimension-repository_network_root_nwopython-humanize/humanize
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
release3215163789b3dc58dba97bd78a30c20c949f477f
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-humanize/humanize/issues/28#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-humanize%2Fhumanize%2Fissues%2F28
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
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/enterprise/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-humanize%2Fhumanize%2Fissues%2F28
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-humanize%2Fhumanize
Reloadhttps://github.com/python-humanize/humanize/issues/28
Reloadhttps://github.com/python-humanize/humanize/issues/28
Reloadhttps://github.com/python-humanize/humanize/issues/28
Please reload this pagehttps://github.com/python-humanize/humanize/issues/28
python-humanize https://github.com/python-humanize
humanizehttps://github.com/python-humanize/humanize
Please reload this pagehttps://github.com/python-humanize/humanize/issues/28
Notifications https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Fork 116 https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Star 736 https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Code https://github.com/python-humanize/humanize
Issues 12 https://github.com/python-humanize/humanize/issues
Pull requests 13 https://github.com/python-humanize/humanize/pulls
Actions https://github.com/python-humanize/humanize/actions
Security and quality 0 https://github.com/python-humanize/humanize/security
Insights https://github.com/python-humanize/humanize/pulse
Code https://github.com/python-humanize/humanize
Issues https://github.com/python-humanize/humanize/issues
Pull requests https://github.com/python-humanize/humanize/pulls
Actions https://github.com/python-humanize/humanize/actions
Security and quality https://github.com/python-humanize/humanize/security
Insights https://github.com/python-humanize/humanize/pulse
Inconsistencies between documentation/annotations and behaviorhttps://github.com/python-humanize/humanize/issues/28#top
bugSomething isn't workinghttps://github.com/python-humanize/humanize/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jun 24, 2022https://github.com/python-humanize/humanize/issues/28#issue-1283965745
bugSomething isn't workinghttps://github.com/python-humanize/humanize/issues?q=state%3Aopen%20label%3A%22bug%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.