semvec/pypi-packages huggingface dataset:
patternSingleton 1.0.2
My implementation of Singleton Design Pattern based on metaclass method.
License: MIT
Keywords: design,pattern,patterns,good,practise,singleton,metaclass

Singleton Design Pattern
========================

My implementation of Singleton Design Pattern based on metaclass method.

Installation
~~~~~~~~~~~~

Just use (No other package is needed):

.. code-block:: sh

    $ pip install patternSingleton

Example Usage
~~~~~~~~~~~~~

.. code-block:: python

    from patternSingleton import Singleton


    class Example(metaclass=Singleton):
        def __init__(self):
            self.variable = 1


    if __name__ == '__main__':
        example_01 = Example()
        example_02 = Example()

        print(example_01.variable)  # displays 1
        print(example_02.variable)  # displays 1

        example_01.variable = 2     # changes value for every instance of Example class

        print(example_01.variable)  # displays 2
        print(example_02.variable)  # displays 2

See me on `github <https://github.com/MarcinMysliwiec>`__

License MIT
~~~~~~~~~~~

**Free Software, Hell Yeah!**