No project description provided
Project description
# 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.
## 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.1.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for singletonify-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 714cd558659f2e4797f1abf7d4182c01bbf8c54329b62ed6b35d833eeb2718df |
|
MD5 | 38f02bf7e66ee542f376c8aae2924ad3 |
|
BLAKE2b-256 | 34f89676e6aeeb751d68759c456fe52bd7d42cd0049d38b8ac4641b58044920e |