Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/oop/inherit_class.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq: 0.56
ci: 0.40
sq: 1.25
ci: 0.18
2 changes: 1 addition & 1 deletion src/oop/inherit_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def find(cls, method_name):
# [/search]

# [use]
examples = [square_new("sq", 3), circle_new("ci", 2)]
examples = [square_new("sq", 2), circle_new("ci", 3)]
for ex in examples:
n = ex["name"]
d = call(ex, "density", 5)
Expand Down
4 changes: 2 additions & 2 deletions src/oop/inherit_constructor.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq: 0.56
ci: 0.40
sq: 1.25
ci: 0.18
2 changes: 1 addition & 1 deletion src/oop/inherit_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def call(thing, method_name, *args):
return method(thing, *args)

# [call]
examples = [make(Square, "sq", 3), make(Circle, "ci", 2)]
examples = [make(Square, "sq", 2), make(Circle, "ci", 3)]
for ex in examples:
n = ex["name"]
d = call(ex, "density", 5)
Expand Down
4 changes: 2 additions & 2 deletions src/oop/inherit_original.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq: 0.56
ci: 0.40
sq: 1.25
ci: 0.18
2 changes: 1 addition & 1 deletion src/oop/inherit_original.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def area(self):
return math.pi * self.radius ** 2

# [use]
examples = [Square("sq", 3), Circle("ci", 2)]
examples = [Square("sq", 2), Circle("ci", 3)]
for ex in examples:
n = ex.name
d = ex.density(5)
Expand Down
2 changes: 1 addition & 1 deletion src/oop/larger.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def call(thing, method_name, *args):
# [/call]

# [example]
examples = [square_new("sq", 3), circle_new("ci", 2)]
examples = [square_new("sq", 2), circle_new("ci", 3)]
for ex in examples:
result = call(ex, "larger", 10)
print(f"is {ex['name']} larger? {result}")
Expand Down
4 changes: 2 additions & 2 deletions src/oop/shapes_class.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq is a Square: 12.00 9.00
ci is a Circle: 12.57 12.57
sq is a Square: 8.00 4.00
ci is a Circle: 18.85 28.27
2 changes: 1 addition & 1 deletion src/oop/shapes_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def circle_new(name, radius):
def call(thing, method_name):
return thing["_class"][method_name](thing)

examples = [square_new("sq", 3), circle_new("ci", 2)]
examples = [square_new("sq", 2), circle_new("ci", 3)]
for ex in examples:
n = ex["name"]
p = call(ex, "perimeter")
Expand Down
4 changes: 2 additions & 2 deletions src/oop/shapes_dict.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq 12.00 9.00
ci 12.57 12.57
sq 8.00 4.00
ci 18.85 28.27
2 changes: 1 addition & 1 deletion src/oop/shapes_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def circle_new(name, radius):
def call(thing, method_name):
return thing[method_name](thing)

examples = [square_new("sq", 3), circle_new("ci", 2)]
examples = [square_new("sq", 2), circle_new("ci", 3)]
for ex in examples:
n = ex["name"]
p = call(ex, "perimeter")
Expand Down
4 changes: 2 additions & 2 deletions src/oop/shapes_original.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sq has perimeter 12.00 and area 9.00
ci has perimeter 12.57 and area 12.57
sq has perimeter 8.00 and area 4.00
ci has perimeter 18.85 and area 28.27
2 changes: 1 addition & 1 deletion src/oop/shapes_original.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def area(self):
# [/concrete]

# [poly]
examples = [Square("sq", 3), Circle("ci", 2)]
examples = [Square("sq", 2), Circle("ci", 3)]
for thing in examples:
n = thing.name
p = thing.perimeter()
Expand Down