Skip to main content

Library to create hybrids of class methods and instance methods

Project description

hybridmethods

A library for the creation of hybrid methods. Methods that can be called as either class methods or instance methods.

Usage

from hybridmethods import cl, hybridmethod, instance


class Test1:
    @hybridmethod
    def method(this):
        if instance(this):  # Run when called as instance method
            pass
        else:  # Run when called as class method
            pass
    

class Test2:
    @cl.assmethod
    def method(cls):
        pass

    @method.instance
    def _(self):
        pass

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

hybridmethods-0.1.3.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

hybridmethods-0.1.3-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

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