simple class for have hybrid class and instance methods
Project description
chibi_hybrid
simple class for have hybrid class and instance methods and add class properties
Free software: WTFPL
Documentation: https://chibi-hybrid.readthedocs.io.
Features
from chibi_hybrid.chibi_hybrid import Chibi_hybrid, Class_property
class Dump:
__bar = ''
def __init__( self, value ):
self.value = value
@Chibi_hybrid
def foo( cls ):
return cls( 'cls' )
@foo.instancemethod
def foo( self ):
return self.value
@Class_property
def bar( cls ):
return cls.__bar
@bar.setter
def bar( cls, value ):
cls.__bar = value
result = Dump.foo()
assert result == Dump
assert 'cls' == result.value
assert 'cls' == result.foo()
result = Dump( 'cosa' ).foo()
assert 'cosa' == result
assert Dump.bar == ''
Dump.bar = "cosa 2"
assert Dump.bar == 'cosa 2'
History
0.0.1 (2019-10-31)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chibi_hybrid-1.1.0.tar.gz
(9.1 kB
view hashes)
Built Distribution
Close
Hashes for chibi_hybrid-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c23d612115b733650c3fa9ab0736c9872bd252441a6bbff6630aac722815e965 |
|
MD5 | cc8bf77396dc01101ece34606ab2c116 |
|
BLAKE2b-256 | d142c69d15fd55af7eca2d74404f0ac29a13ccbb1c7399f5833179e6f5ebe38b |