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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file singletonify-0.2.1.tar.gz.
File metadata
- Download URL: singletonify-0.2.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caa8339813cd5eba950d68f1a15a4c2d8b53d3421b8bf1682ea0126bd14eff14
|
|
| MD5 |
c95b95325dd49b977e41d0310a632c02
|
|
| BLAKE2b-256 |
d4e0fb9d5b47eb21f3794d3c741ec27c6decc925177e0832b0a1194e754cddf5
|
File details
Details for the file singletonify-0.2.1-py3-none-any.whl.
File metadata
- Download URL: singletonify-0.2.1-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
714cd558659f2e4797f1abf7d4182c01bbf8c54329b62ed6b35d833eeb2718df
|
|
| MD5 |
38f02bf7e66ee542f376c8aae2924ad3
|
|
| BLAKE2b-256 |
34f89676e6aeeb751d68759c456fe52bd7d42cd0049d38b8ac4641b58044920e
|