SelfCount/sasasagagaga | SelfCount/SVasi1yev | ||||
---|---|---|---|---|---|
n | 1 | n | |||
2 | class WeAre: | 1 | class WeAre: | ||
3 | count = 0 | 2 | count = 0 | ||
4 | 3 | ||||
5 | def __init__(self): | 4 | def __init__(self): | ||
6 | type(self).count += 1 | 5 | type(self).count += 1 | ||
7 | 6 | ||||
8 | def __del__(self): | 7 | def __del__(self): | ||
9 | type(self).count -= 1 | 8 | type(self).count -= 1 | ||
10 | 9 | ||||
t | 11 | t | |||
12 | # a = WeAre() | ||||
13 | # print(a.count) | ||||
14 | # b, c = WeAre(), WeAre(), | ||||
15 | # print(a.count, b.count, c.count) | ||||
16 | # del b | ||||
17 | # print(a.count) | ||||
18 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|