MCPcopy Create free account
hub / github.com/DasyDong/developer-roadmap / __new__

Method __new__

code/run_class.py:18–21  ·  view source on GitHub ↗
(cls, *args, **kwargs)

Source from the content-addressed store, hash-verified

16
17class Singleton(object):
18 def __new__(cls, *args, **kwargs):
19 if not hasattr(cls, '_instance'):
20 cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs)
21 return cls._instance
22
23
24class TestSingle2(Singleton):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected