Skip to content

v0.0.344: iter(fn, sentinel) + slice.indices + _CacheInfo#265

Merged
tamnd merged 1 commit into
mainfrom
feat/v0.0.344-iter-slice-cacheinfo
Apr 29, 2026
Merged

v0.0.344: iter(fn, sentinel) + slice.indices + _CacheInfo#265
tamnd merged 1 commit into
mainfrom
feat/v0.0.344-iter-slice-cacheinfo

Conversation

@tamnd

@tamnd tamnd commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • iter(callable, sentinel) two-arg form (F4): returns iterator that calls callable until result equals sentinel.
  • slice.indices(n) (F5): normalises slice against length, mirrors CPython PySlice_GetIndices.
  • functools.lru_cache.cache_info() returns a _CacheInfo namedtuple (C5) — info.hits/.misses/.maxsize/.currsize plus tuple indexing.
  • Spec: notes/Spec/1500/1538_goipy_v0044_iter_slice_cacheinfo.md. Fixture: internal/testdata/344_iter_slice_cacheinfo.py.

Test plan

  • go test ./... -timeout 600s green
  • Fixture 344 matches CPython
  • No regression on iter/slice/functools fixtures

Closes F4, F5, and C5 from the v0.1.0 audit. Three small surface fixes
that don't share implementation but each is too small for its own
release.

iter(callable, sentinel) returns an iterator that calls callable until
the result equals sentinel. slice.indices(n) normalises the slice
against length n, mirroring CPython's PySlice_GetIndices; raises
ValueError on step==0.

functools.lru_cache.cache_info() now returns a _CacheInfo(hits, misses,
maxsize, currsize) namedtuple built via makeNamedTuple; both
info.hits and info[0] work, and the class is exposed on the functools
module dict for isinstance checks.

Spec at notes/Spec/1500/1538_goipy_v0044_iter_slice_cacheinfo.md.
@tamnd tamnd merged commit 596e421 into main Apr 29, 2026
1 check passed
@tamnd tamnd deleted the feat/v0.0.344-iter-slice-cacheinfo branch April 29, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant