Skip to main content

@self decorator makes method return self (jQuery-like chaining)

Project description

https://img.shields.io/badge/Language-Python-blue.svg?style=plastic https://img.shields.io/pypi/pyversions/self.svg

https://codeclimate.com/github/russianidiot/self.py/badges/gpa.svg https://landscape.io/github/russianidiot/self.py/master/landscape.svg?style=flat https://scrutinizer-ci.com/g/russianidiot/self.py/badges/quality-score.png?b=master

Usage

>>> from self import self

>>> @self
        def method(self):

Examples

>>> class CLS:
        @self
        def method(self):
                print("test")

        @self
        def method2(self):
                print("test")

>>> CLS().method().method2() # jQuery like chain

Feedback github_follow github_issues

Supported by

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