This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/Python/OOP3/task6.py
2023-07-16 13:23:25 +00:00

14 lines
249 B
Python

class Singleton(object):
obj = None
def __new__(cls, *args, **kwards):
if cls.obj is None:
cls.obj = object.__new__(cls)
return cls.obj
sing1 = Singleton()
sing2 = Singleton()
print(id(sing1))
print(id(sing2))