Skip to content

Commit 4b41081

Browse files
committed
faster pace
1 parent a70eaf3 commit 4b41081

13 files changed

+8
-63
lines changed

02-property_macro.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ def variable(self, value):
1616
return variable
1717

1818

19+
ensure_int = lambda name: check_type(name, int) # noqa
20+
ensure_point = lambda name: check_type(name, Point) # noqa
21+
22+
1923
class Point:
20-
x = check_type('x', int)
21-
y = check_type('y', int)
24+
x = ensure_int('x')
25+
y = ensure_int('y')
2226

2327
def __init__(self, x, y):
2428
self.x = x
@@ -36,8 +40,8 @@ def __repr__(self):
3640

3741

3842
class Circle:
39-
center = check_type('center', Point)
40-
radius = check_type('radius', int)
43+
center = ensure_point('center')
44+
radius = ensure_int('radius')
4145

4246
def __init__(self, center, radius):
4347
self.center = center
File renamed without changes.

03-property_macro_redux.py

Lines changed: 0 additions & 59 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)