Skip to content

Commit afa733a

Browse files
committed
added __copy__() and __repr__() to lampsort[1|2|3].py
1 parent f361061 commit afa733a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

data/python/lampsort1.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ class LampSort:
44
def __init__(self, data):
55
self.data = data
66

7+
def __copy__(self):
8+
return LampSort(self.data.copy())
9+
10+
def __repr__(self):
11+
return 'LampSort'+(self.data.__repr__())
12+
713
@gtTrace
814
def sort(self):
915
intervals = set([range(0, len(self.data))])

data/python/lampsort2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ class LampSort:
55
def __init__(self, data):
66
self.data = data
77

8+
def __copy__(self):
9+
return LampSort(self.data.copy())
10+
11+
def __repr__(self):
12+
return 'LampSort'+(self.data.__repr__())
13+
814
@gtTrace
915
def sort(self):
1016
intervals = set([range(0, len(self.data))])

data/python/lampsort3.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class LampSort:
2222
def __init__(self, data):
2323
self.data = data
2424

25+
def __copy__(self):
26+
return LampSort(self.data.copy())
27+
28+
def __repr__(self):
29+
return 'LampSort'+(self.data.__repr__())
30+
2531
@gtTrace
2632
def sort(self):
2733
intervals = set([range(0, len(self.data))])

0 commit comments

Comments
 (0)