Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/phohenecker/static-init

A class decorator for invoking static constructors.
https://github.com/phohenecker/static-init

decorators python3

Last synced: about 6 hours ago
JSON representation

A class decorator for invoking static constructors.

Awesome Lists containing this project

README

        

static-init
===========

The module [staticinit](staticinit.py) defines the decorator `@staticinit.init()` for classes, which executes a static
constructor after the annotated class has been created.
By default, the name of the according constructor method is assumed to be `__static_init__`, but an alternative name may
be specified via the keyword arg `init_meth`.
Notice further that the constructor has to be a class method.

The following example illustrates how to use this module:
```python
import staticinit

@staticinit.init()
class SomeClass(object):

@classmethod
def __static_init__(cls):
# do some initialization stuff here...
```

Installation
------------

This module can be installed from PyPI:
```
pip install staticinit
```