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:
@classmethod
def method(cls):
pass
@classmethod.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.2.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for hybridmethods-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0c4d3c7d4d4065995a89b719c45d5a20d015da4b6e211764ce9b453d8a2d508 |
|
MD5 | 587ccfa772ee7195fed3111044727bdd |
|
BLAKE2b-256 | 0e278a64dc13b1e5ad8078e1c63f3d6413475340011ca26fe80aeaf1b8ef551b |