-
Notifications
You must be signed in to change notification settings - Fork 28
/
test3.py
74 lines (57 loc) · 1.53 KB
/
test3.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
import numpy as np
class Singleton(type):
_instances = {}
great = {3,2,1}
def __call__(cls, *args, **kwargs):
if (cls, *args) not in cls._instances:
cls._instances[(cls, *args)] = super(Singleton, cls).__call__(*args, **kwargs)
print(cls)
print(cls._instances)
return cls._instances[(cls, *args)]
# class A(metaclass = Singleton):
# # print(A._instances)
# def __init__(self, a = 3):
# self.a = a
# class B(A):
# def __init__(self):
# super().__init__()
# self.b = 0
# class C:
# m = 0
# class IdentityMatrix:
# def __matmul__(self, other):
# return other
# def __rmatmul__(self, other):
# return other
# __array_priority__ = 1
# class _sRGB():
# # io = D65_2
# a = 0.055
# gamma = 2.4
# # _linear()
# def _linear(self):
# '''
# linearization parameters
# see ColorSpace.pdf for details;
# '''
# self.alpha = self.a+1
# self.K0 = self.a/(self.gamma-1)
# self.phi = (self.alpha**self.gamma*(self.gamma-1)**(self.gamma-1))/(self.a**(self.gamma-1)*self.gamma**self.gamma)
# self.beta = self.K0/self.phi
class A:
i = [10]
class B(A):
pass
# class A:
# def __init__(self):
# self.__name__ = type(self).__name__
# class B(A):
# def __init__(self):
# super().__init__()
# self.c=0
if __name__ == "__main__":
a = A()
b = B()
print(a.i, b.i)
b.i.append(5)
print(a.i, b.i)