An open API service indexing awesome lists of open source software.

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

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).