-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
79 lines (53 loc) · 1.4 KB
/
test.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# check if object given to a function of a other object is a copy or a reference
import numpy as np
a = [0.999999, 0.999999, 0.999999, 2.999999]
b = [0.999999, 0.999999, 3.999999, 2.999999]
print(np.multiply(a, b))
test = ["test1", "test2", "test3"]
print(test)
test.append("test4")
print(test)
test.pop(1)
print(test)
test.insert(0, "test0")
print(test)
class Main (object):
def __init__ (self):
self.test = "Johann"
print(self.test)
self.data = np.ones((10, 5))
self.data[1,1] = 5
self.data[1,3] = 5
self.data[2,0] = 5
self.data[4,2] = 5
self.data[8,3] = 5
def output (self):
print(self.test)
def doMutation(self):
print(self.data)
newData = self.data
for i,row in enumerate(newData):
for j,tile in enumerate(row):
if (i == 1 and j == 1):
print(self.data)
self.data[i][j] = tile * 2
print(self.data)
print("done")
class Test (object):
def __init__ (self):
self.test2 = "Weiß"
print(self.test2)
def output (self, main):
print(self.test2)
print(main.test)
def change (self, main):
main.test += self.test2
print("after change")
print(main.test)
main = Main()
main.output()
test = Test()
test.change(main)
test.output(main)
main.output()
main.doMutation()