Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Singleton Design in Python
#python 3.5.2 class Singleton: __instance =None; @staticmethod def getSingleton(): if Singleton.__instance == None: Singleton() return Singleton.__instance def __init__(self): if Singleton.__instance != None: raise Exception("This is a singleton class:") else: Singleton.__instance =self s = Singleton() r = Singleton() print(s.getSingleton())
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
числа близнецы
Reading XML file for modification
python codewars
Atur cara mengira luas dan isipadu sebuah trapezium
linked_lists
Implementation of Singleton pattern
global 3
CalcV3 with PLY
print path module python
abstractmethod 2
Please log in to post a comment.