A simple python module to provide .__super ability to python 2 classes.
Project description
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__()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
supertools-1.0.1.tar.gz
(2.4 kB
view details)
File details
Details for the file supertools-1.0.1.tar.gz
.
File metadata
- Download URL: supertools-1.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b0f43af417d719171254a1502ecc7d771e5dd677b681027f8bde4d2d5a10f65 |
|
MD5 | bec89964765c82231d1466b6e2aae687 |
|
BLAKE2b-256 | 22262fd344b83d12bc6be37c336a6dd00754254c3fa10d8f3d330089f488a83f |