| SelfCount/DEX | SelfCount/Aleksyav | ||||
|---|---|---|---|---|---|
| f | 1 | class WeAre: | f | 1 | class WeAre: |
| n | 2 | count: int = 0 | n | 2 | count = 0 |
| 3 | 3 | ||||
| 4 | def __init__(self): | 4 | def __init__(self): | ||
| 5 | WeAre.count += 1 | 5 | WeAre.count += 1 | ||
| 6 | 6 | ||||
| 7 | def __del__(self): | 7 | def __del__(self): | ||
| 8 | WeAre.count -= 1 | 8 | WeAre.count -= 1 | ||
| 9 | 9 | ||||
| t | 10 | t | |||
| 11 | # def main(): | ||||
| 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 | # | ||||
| 19 | # | ||||
| 20 | # if __name__ == '__main__': | ||||
| 21 | # main() | ||||
| 22 | |||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||