No project description provided
Project description
# singletonify
[![Build Status](https://travis-ci.com/Cologler/singletonify-python.svg?branch=master)](https://travis-ci.com/Cologler/singletonify-python)
## 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.
[![Build Status](https://travis-ci.com/Cologler/singletonify-python.svg?branch=master)](https://travis-ci.com/Cologler/singletonify-python)
## 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.3.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for singletonify-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e8d6c895d8de72d126e0b523f3c34817442201245da517c91c4a29d82ad133 |
|
MD5 | d800c7388037203e283f7a44e8633f97 |
|
BLAKE2b-256 | 04a242e42669f605a5da9f3e8ea3665ec9158aaf8986dfe6b90b12f8416bc814 |