init: company-haness 설계

This commit is contained in:
DongHyeonka
2026-07-23 17:49:00 +09:00
parent 57d1bab894
commit f668d6a158
962 changed files with 98989 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
"""Pagination helper — contains an off-by-one bug that drops the last item of a page.
The bug: `end = start + size - 1` and slicing `items[start:end]` excludes the last
element of each page. A correct implementation returns exactly `size` items per page
(and the remainder on the final page).
"""
def paginate(items, page, size):
"""Return the `page`-th (1-indexed) slice of `items` with `size` per page."""
start = (page - 1) * size
end = start + size - 1 # BUG: off-by-one — drops the last item of the page
return items[start:end]