Skip to main content

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 hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page