Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ea6ac1

Browse files
committed
Removing (object) from class defs
1 parent fb28032 commit 5ea6ac1

16 files changed

+26
-19
lines changed

code/BadKangaroo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
"""
2121

22-
class Kangaroo(object):
22+
class Kangaroo:
2323
"""A Kangaroo is a marsupial."""
2424

2525
def __init__(self, name, contents=[]):

code/Card.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import random
1515

1616

17-
class Card(object):
17+
class Card:
1818
"""Represents a standard playing card.
1919
2020
Attributes:
@@ -45,7 +45,7 @@ def __lt__(self, other):
4545
return t1 < t2
4646

4747

48-
class Deck(object):
48+
class Deck:
4949
"""Represents a deck of cards.
5050
5151
Attributes:

code/Circle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from Point1_soln import distance_between_points
1818

1919

20-
class Circle(object):
20+
class Circle:
2121
"""Represents a circle.
2222
2323
Attributes: center, radius
@@ -106,7 +106,7 @@ def main():
106106

107107
circle = Circle
108108
circle.center = Point()
109-
circle.center.x = 100.0
109+
circle.center.x = 150.0
110110
circle.center.y = 100.0
111111
circle.radius = 75.0
112112

code/GoodKangaroo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
"""
2121

22-
class Kangaroo(object):
22+
class Kangaroo:
2323
"""A Kangaroo is a marsupial."""
2424

2525
def __init__(self, name, contents=[]):

code/Map.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function, division
1313

1414

15-
class LinearMap(object):
15+
class LinearMap:
1616
"""A simple implementation of a map using a list of tuples
1717
where each tuple is a key-value pair."""
1818

@@ -33,7 +33,7 @@ def get(self, k):
3333
raise KeyError
3434

3535

36-
class BetterMap(object):
36+
class BetterMap:
3737
"""A faster implementation of a map using a list of LinearMaps
3838
and the built-in function hash() to determine which LinearMap
3939
to put each key into."""
@@ -60,7 +60,7 @@ def get(self, k):
6060
return m.get(k)
6161

6262

63-
class HashMap(object):
63+
class HashMap:
6464
"""An implementation of a hashtable using a BetterMap
6565
that grows so that the number of items never exceeds the number
6666
of LinearMaps.

code/Markov.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from markov import skip_gutenberg_header, shift
1919

2020

21-
class Markov(object):
21+
class Markov:
2222
"""Encapsulates the statistical summary of a text."""
2323

2424
def __init__(self):

code/Point1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function, division
1313

1414

15-
class Point(object):
15+
class Point:
1616
"""Represents a point in 2-D space.
1717
1818
attributes: x, y
@@ -24,7 +24,7 @@ def print_point(p):
2424
print('(%g, %g)' % (p.x, p.y))
2525

2626

27-
class Rectangle(object):
27+
class Rectangle:
2828
"""Represents a rectangle.
2929
3030
attributes: width, height, corner.

code/Point2_soln.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function, division
1313

1414

15-
class Point(object):
15+
class Point:
1616
"""Represents a point in 2-D space.
1717
1818
attributes: x, y

code/Time1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function, division
1313

1414

15-
class Time(object):
15+
class Time:
1616
"""Represents the time of day.
1717
1818
attributes: hour, minute, second

code/Time2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function, division
1313

1414

15-
class Time(object):
15+
class Time:
1616
"""Represents the time of day.
1717
1818
attributes: hour, minute, second
@@ -96,6 +96,7 @@ def main():
9696
start.print_time()
9797

9898
end = start.increment(1337)
99+
#end = start.increment(1337, 460)
99100
end.print_time()
100101

101102
print('Is end after start?')

0 commit comments

Comments
 (0)