https://github.com/nlm/python-singletonmeta
Python library to easily make singleton classes
https://github.com/nlm/python-singletonmeta
Last synced: 22 days ago
JSON representation
Python library to easily make singleton classes
- Host: GitHub
- URL: https://github.com/nlm/python-singletonmeta
- Owner: nlm
- Created: 2019-07-08T11:43:36.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-08T11:43:55.000Z (about 7 years ago)
- Last Synced: 2025-01-21T21:47:33.231Z (over 1 year ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SingletonMeta
A python module for easily creating singletons
## SingletonMeta
A metaclass to restricts the instantiation of a class to one "single" instance.
```
>> from singletonmeta import SingletonMeta
>>
>> class MyClass(metaclass=SingletonMeta):
.. pass
..
>> print(id(Myclass()) == id(MyClass()))
True
```
## ThreadSafeSingletonMeta
A metaclass to restricts the instantiation of a class to one "single" instance,
thread-safe version (using lock).