-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.py
41 lines (31 loc) · 816 Bytes
/
class.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class Nothing:
def __init__(self, name) -> None:
self.name = name
self.data = []
def __repr__(self) -> str:
s = self.name + '['
prev = False
for k in self.data:
if prev == True:
s += ';'
s += k
prev = True
s += ']'
return s
def __str__(self) -> str:
return "Nothing"
def fill(self, stuff):
self.data.append(stuff)
def size(self) -> int:
return self.data.__sizeof__()
def __getitem__(self, key):
return self.data[key]
def __setitem__(self, key, value):
self.data[key] = value
n = Nothing("hello")
n.fill("big")
n.fill("alot of stuff")
# print(n)
def getStuff(s:str = None) -> str or bool:
return "stuff"
stuff = getStuff()