alone

Metaclass that defines a class as a singleton


Keywords
singleton, python, python27, python3, singleton-pattern
License
MIT
Install
pip install alone==0.1.7

Documentation

Alone

Metaclass that defines a class as a singleton.

Kudo to theheadofabroom from SO for the implementation

Getting started

Python 2:

import alone.MetaSingleton

class YourClass(alone.MetaSingleton):
    pass

Python 3:

import alone.MetaSingleton

class YourClass(metaclass=alone.MetaSingleton):
    pass