{"id":21858246,"url":"https://github.com/simpleart/sliceit","last_synced_at":"2026-04-19T03:32:43.658Z","repository":{"id":57468340,"uuid":"465594482","full_name":"SimpleArt/sliceit","owner":"SimpleArt","description":"Dynamically sized slice views which avoid storing their own data.","archived":false,"fork":false,"pushed_at":"2022-03-03T22:55:33.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T05:55:18.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SimpleArt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-03T06:23:10.000Z","updated_at":"2022-03-03T06:23:48.000Z","dependencies_parsed_at":"2022-09-19T09:31:26.972Z","dependency_job_id":null,"html_url":"https://github.com/SimpleArt/sliceit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimpleArt%2Fsliceit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimpleArt%2Fsliceit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimpleArt%2Fsliceit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimpleArt%2Fsliceit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimpleArt","download_url":"https://codeload.github.com/SimpleArt/sliceit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244857843,"owners_count":20522100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-28T02:44:26.864Z","updated_at":"2026-04-19T03:32:43.624Z","avatar_url":"https://github.com/SimpleArt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"sliceit\n--------\nDynamically sized slice views which avoid storing their own data.\n\nThe builtin list, tuple, str, etc., create copies when sliced.\nThis is to allow all of the unnecessary memory to be freed if it\nis no longer needed. In some cases, the opposite problem occurs,\nwhere none of the memory needs to be freed anyways, meaning slices\nsimply take up more space than necessary.\n\nSome data structures provide slicing views already, such as:\n- numpy\n- pandas\n- tensorflow\n- and many other data science packages\n\nIf these packages already fit your needs, consider using them instead.\n\nWhat's different?\n------------------\n`sliceit` provides sliceable views any `Sequence` (or `MutableSequence`),\nmeaning it works for lists, tuples, strings, etc., and can also be used\nas an easy way to implement slicing for custom classes.\n\nFurthermore, `sliceit` uses lazily evaluated slices. This means the\nunderlying data is free to change size as much as it wants. The catch\nis that some objects may raise runtime errors if you try iterating\nover them at the same time.\n\nUnlike some, `sliceit` is also recursively sliceable and supports mutations,\nalthough modifying slices may in some cases be unintuitive.\n\nInstall\n--------\nUnix/macOS:\n\n```cmd\npython3 -m pip install sliceit\n```\n\nWindows:\n\n```cmd\npy -m pip install sliceit\n```\n\nExamples\n---------\n\n```python\nfrom sliceit import sliceit\n\nprint(\"Create a slice view of some data.\")\nL = list(range(10))\nS = sliceit(L)[::-1]\nprint(f\"L = {L}\")\nprint(f\"list(S) = {list(S)}\")\n\nprint()\n\nprint(\"Slices act as a view over the data.\")\nprint(f\"list(S) = {list(S)}\")\nL[0] = -10\nprint(f\"L[0] := -10\")\nprint(f\"list(S) = {list(S)}\")\nL[0] = 0\nprint(f\"L[0] := 0\")\nprint(f\"list(S) = {list(S)}\")\n\nprint()\n\nprint(\"They can be looped over or indexed as you would expect.\")\nprint(f\"[x for x in S] = {[x for x in S]}\")\nprint(f\"S[0] = {S[0]}\")\n\nprint()\n\nprint(\"If the data is mutable, the slice is mutable.\")\nS[0] = 0\nprint(\"S[0] := 0\")\nprint(f\"L[-1] = {L[-1]}\")\nS[0] = 9\nprint(\"S[0] := 9\")\nprint(f\"L[-1] = {L[-1]}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpleart%2Fsliceit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpleart%2Fsliceit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpleart%2Fsliceit/lists"}