Run Code
|
API
|
Code Wall
|
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
26.09.2018
LinkedList in Python
Factorial
miyabhai
h
rstring
pyFoodTipFoodOrder
DICTIONARY PROBLEM
Name
lesson 6 finallll