A simple python 2 decorator that provide .__super member to python2 classes as private static member in order to not have to specify the current class name.
Without super nor supertools:
class MyClass(MyParent) :
def __init__(self) :
MyParent.__init__(self)
Classical implementation using super (python 2 syntax):
class MyClass(MyParent) :
def __init__(self) :
super(MyClass,self).__init__()
Using supertools:
from supertools import superable
@superable
class MyClass(MyParent) :
def __init__(self) :
self.__super.__init__()
Syntax is nice, dosn’t repeat neither classname nor parent classname, and doesn’t parse callstack at runtime like other similar modules does.
Note that this syntax is however not compatible with python 3 syntax, which would be in this case:
class MyClass(MyParent) :
def __init__(self) :
super().__init__()
Metadata
Release files for supertools 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| supertools-1.0.1.tar.gz | 2.4 kB | Details |
Release files / supertools-1.0.1.tar.gz
| Download URL | supertools-1.0.1.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b0f43af417d719171254a1502ecc7d771e5dd677b681027f8bde4d2d5a10f65
|
|
BLAKE2b-256 checksum How to use checksums |
22262fd344b83d12bc6be37c336a6dd00754254c3fa10d8f3d330089f488a83f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |