A class decorator for invoking static constructors.
Project description
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...
```
===========
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...
```
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
staticinit-v2017.1.tar.gz
(2.6 kB
view details)
File details
Details for the file staticinit-v2017.1.tar.gz
.
File metadata
- Download URL: staticinit-v2017.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d368f8b02ade4dff8751b48ebebba37ff1051634946356a752f0eb0048ae3a33 |
|
MD5 | fff943c14642e3c4758df0ad9d9f4246 |
|
BLAKE2b-256 | 824b035e5984f3761f1efc1dbd181d1bf308600fc20b44b4e2ab0389b2914136 |