No project description provided
Project description
# singletonify
[](https://travis-ci.com/Cologler/singletonify-python)
[](https://pypi.org/project/singletonify/)
## install
``` cmd
pip install singletonify
```
## usage
``` py
@singleton(a=3)
class YourClass:
def __init__(self, a): ...
assert YourClass() is YourClass()
```
## why not other
There are many singleton libraries on pypi, but their all has problem:
* [singleton](https://pypi.python.org/pypi/singleton) - cannot use `issubclass()` or `__mro__` or ...
* [singleton-decorator](https://pypi.python.org/pypi/singleton-decorator) - cannot use `isinstance()` .
* [singleton_factory](https://pypi.python.org/pypi/singleton_factory) - wtf, why do people use `dict()[hash(obj)] = obj` ?
* [singletonmetaclasss](https://pypi.python.org/pypi/singletonmetaclasss/0.1) - a little like this, but not a decorator.
* [singleton3](https://pypi.python.org/pypi/singleton3) - haha
* [pysingleton](https://pypi.python.org/pypi/pysingleton) - ABANDONED.
[](https://travis-ci.com/Cologler/singletonify-python)
[](https://pypi.org/project/singletonify/)
## install
``` cmd
pip install singletonify
```
## usage
``` py
@singleton(a=3)
class YourClass:
def __init__(self, a): ...
assert YourClass() is YourClass()
```
## why not other
There are many singleton libraries on pypi, but their all has problem:
* [singleton](https://pypi.python.org/pypi/singleton) - cannot use `issubclass()` or `__mro__` or ...
* [singleton-decorator](https://pypi.python.org/pypi/singleton-decorator) - cannot use `isinstance()` .
* [singleton_factory](https://pypi.python.org/pypi/singleton_factory) - wtf, why do people use `dict()[hash(obj)] = obj` ?
* [singletonmetaclasss](https://pypi.python.org/pypi/singletonmetaclasss/0.1) - a little like this, but not a decorator.
* [singleton3](https://pypi.python.org/pypi/singleton3) - haha
* [pysingleton](https://pypi.python.org/pypi/pysingleton) - ABANDONED.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
singletonify-0.2.4.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for singletonify-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2508c0630611f72061bb396427c9a2932d9909cc07ebaa479edef01f64dab336 |
|
MD5 | 991c0c53f21e04fb7d5fc5751154f383 |
|
BLAKE2b-256 | 4b317aa2ad2a40cada659a46ad2441de4bda08cc2385c40ce7886b976f59b2ca |