Skip to content

Commit 34c3894

Browse files
committed
float advanced, final + chklist
1 parent 0a5621e commit 34c3894

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Benchmark/float/advanced/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
2-
from typing import List
32
from math import sin, cos, sqrt
3+
from __static__ import CheckedList, inline
4+
from typing import final
45
import time
56
"""
67
bg:
@@ -11,7 +12,7 @@
1112
- remove unused imports
1213
"""
1314

14-
15+
@final
1516
class Point(object):
1617

1718
def __init__(self: Point, i: float) -> None:
@@ -35,16 +36,15 @@ def maximize(self: Point, other: Point) -> Point:
3536
self.z = self.z if self.z > other.z else other.z
3637
return self
3738

38-
39-
def maximize(points: List[Point]) -> Point:
39+
def maximize(points: CheckedList[Point]) -> Point:
4040
next: Point = points[0]
4141
for p in points[1:]:
4242
next = next.maximize(p)
4343
return next
4444

45-
45+
@inline
4646
def benchmark(n: int) -> Point:
47-
points: List[Point] = [Point(i) for i in range(n)]
47+
points: CheckedList[Point] = CheckedList[Point]([Point(i) for i in range(n)])
4848
for p in points:
4949
p.normalize()
5050
return maximize(points)

0 commit comments

Comments
 (0)