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.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file supertools-1.0.0.tar.gz.

File metadata

  • Download URL: supertools-1.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for supertools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ae89bf78e01533cc11fe8ee132fed9467e7637732d064b1d5625add7f4fbb82c
MD5 3041797c38650a0c9aa98bee728c346b
BLAKE2b-256 aecabdd22c0392b9e1c982419d0093543d09804ae1974ff25fa2f7824bc194cd

See more details on using hashes here.

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