|
|
|
|
|
by NeutralForest
317 days ago
|
|
I've never seen anybody do that... In Python you can use a module as a singleton (mentioned in the article). Or provide some data like: from functools import lru_cache
class Whatever:
pass
@lru_cache(maxsize=1)
def get_whatever():
return Whatever()
And use `get_whatever` as your interface to get the resource. |
|