Skip to content

Commit fd663f4

Browse files
committed
Merge branch '2025-typehints'
2 parents d5b2a2f + a6ec841 commit fd663f4

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

2025/typehints/generic_return.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from collections.abc import Iterable
2+
3+
4+
def calculate_discounts(items: Iterable[float], discount: float) -> Iterable[float]:
5+
return [item * (1 - discount) for item in items]
6+
7+
8+
def main() -> None:
9+
items = [100, 200, 300]
10+
discount = 0.2
11+
discounted_items = calculate_discounts(items, discount)
12+
print(len(discounted_items)) # type issue here
13+
print(discounted_items[0]) # type issue here
14+
15+
16+
if __name__ == "__main__":
17+
main()

2025/typehints/pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
name = "typehints"
3+
version = "0.0.1"
4+
authors = [{name = "ArjanCodes"}]
5+
license = {text = "MIT"}
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"mypy>=1.15.0",
9+
]
10+
11+
[tool.pytest.ini_options]
12+
pythonpath = "src"

2025/typehints/uv.lock

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)