{"id":17231979,"url":"https://github.com/pushfoo/python-better-sum","last_synced_at":"2026-01-28T14:33:24.709Z","repository":{"id":248905625,"uuid":"828649675","full_name":"pushfoo/python-better-sum","owner":"pushfoo","description":"Python's sum, minus ugly annotations and extra arguments.","archived":false,"fork":false,"pushed_at":"2025-07-04T03:45:28.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2026-01-03T08:36:00.098Z","etag":null,"topics":["python","standard-library","sum","type-annotations"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pushfoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-14T19:24:35.000Z","updated_at":"2025-07-04T03:45:31.000Z","dependencies_parsed_at":"2025-04-14T01:50:51.237Z","dependency_job_id":"a54e88ac-5cf2-4453-bffb-9d4715f8db18","html_url":"https://github.com/pushfoo/python-better-sum","commit_stats":null,"previous_names":["pushfoo/python-better-sum"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pushfoo/python-better-sum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushfoo%2Fpython-better-sum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushfoo%2Fpython-better-sum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushfoo%2Fpython-better-sum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushfoo%2Fpython-better-sum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pushfoo","download_url":"https://codeload.github.com/pushfoo/python-better-sum/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushfoo%2Fpython-better-sum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T13:02:32.985Z","status":"ssl_error","status_checked_at":"2026-01-28T13:02:04.945Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","standard-library","sum","type-annotations"],"created_at":"2024-10-15T05:00:11.864Z","updated_at":"2026-01-28T14:33:24.692Z","avatar_url":"https://github.com/pushfoo.png","language":"Python","readme":"# better-sum\n\n[![License](https://img.shields.io/badge/License-BSD_2-Clause.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)\n![pytest](https://github.com/pushfoo/python-better-sum/actions/workflows/pytest.yaml/badge.svg?event=push)\n![pyright](https://github.com/pushfoo/python-better-sum/actions/workflows/pyright.yaml/badge.svg?event=push)\n\n[sum]: https://docs.python.org/3/library/functions.html#sum\n[mkdocs]: https://www.mkdocs.org/\n[typing-extensions]: https://pypi.org/project/typing-extensions/\n[decorator]: docs/usage.md#decorator\n[class attribute]: docs/usage.md#a-class-attribute\n\nPython's [sum][], minus ugly annotations and extra arguments.\n\n## Project goals\n\n- [x] Prototype a cleaner [sum][]\n- [x] Try [mkdocs][]\n\n## Quickstart\n\n1. Create a virtual environment with Python 3.9+\n2. `pip install better-sum`\n3. Try the code below\n\n```python\nfrom __future__ import annotations  # Allows forward references on Python \u003c 3.11\nfrom typing import NamedTuple\nfrom better_sum import sum, sum_starts_at_instance\n\n\n@sum_starts_at_instance(0.0, 0.0)  # 1. Create \u0026 store a default instance\nclass Vec2(NamedTuple):\n\n    x: float = 0.0\n    y: float = 0.0\n\n    def __add__(self, other: tuple[float, float]) -\u003e Vec2:\n        other_x, other_y = other\n        return self.__class__(self.x + other_x, self.y + other_y)\n\n    def __radd__(self, other: tuple[float, float]) -\u003e Vec2:\n        other_x, other_y = other\n        return self.__class__(other_x + self.x, other_y + self.y)\n\n # 2. better_sum.sum automatically starts at the default instance\nto_sum = [Vec2(0.0, 0.0), Vec2(1.0, 1.0), Vec2(2.0, 2.0)]\nprint(sum(to_sum))\n```\n\nAs expected, this will print:\n```\nVec(x=3.0, y=3.0)\n```\n[release]: https://better-sum.readthedocs.io/en/latest/\n[development-branch]: https://better-sum.readthedocs.io/en/development/\n[Contributing]:  https://better-sum.readthedocs.io/en/development/contributing/\n\n## Documentation\n| [`release` branch][release]                                                                                                                           | [`development` branch][development-branch]                                                                                                                                    | [Contributing Guide][Contributing] |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|\n | [![Documentation (main)](https://readthedocs.org/projects/better-sum/badge/?version=latest)](https://better-sum.readthedocs.io/en/latest/?badge=main) | [![Documentation (development)](https://readthedocs.org/projects/better-sum/badge/?version=development)](https://better-sum.readthedocs.io/en/development/?badge=development) | Same as `development`              |\n\n## What's wrong with Python's sum?\n\nIt complicates code.\n\n```python\n# The bad: verbose calls\nsum(iterable, start_value)\n\n# The ugly: gross type annotations\nclass SupportsSum:\n\n    # int is ugly\n    def __radd__(self, other: int | SupportsSum):\n        if other == 0:\n            return self\n        ...\n```\n\n## What's the catch?\n\n[pyglet]: https://pyglet.readthedocs.io/en/latest/\n\nA potential speed hit from indirection.\n\nIf it's a concern, then one of two things is true:\n\n1. You should be using binary-backed acceleration\n2. You're writing code for one of the following:\n   * [pyglet][] or another pure-Python project\n   * fallback code for when binary acceleration isn't available\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushfoo%2Fpython-better-sum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpushfoo%2Fpython-better-sum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushfoo%2Fpython-better-sum/lists"}