Skip to main content

A package for creating chainable method calls in Python

Project description

pyChainable

pyChainable 是一个 Python 包,允许您创建可链式调用的方法,同时保持对原始值的操作能力。

使用方法

python setup.py bdist_wheel
pip install dist/pyChainable-0.1.0-py3-none-any.whl
from pychain import chainable
class MyClass:
    def __init__(self):
        self.value = 0

    @chainable
    def add(self, num):
        self.value += num
        return self.value

    @chainable
    def multiply(self, num):
        self.value *= num
        return self.value

obj = MyClass()
result = obj.add(1).add(2).multiply(3)
print(result)

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

pychainable-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyChainable-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file pychainable-0.1.0.tar.gz.

File metadata

  • Download URL: pychainable-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pychainable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b499d047c27ac73df565de5b33dd2e2c614d8426e9033b1c53739d562cfa8359
MD5 fb5cb1b33ba50f44c2e06d24dea949d8
BLAKE2b-256 22eb4c8f74b37c17d6a2f9440f88ddb4f780adade631607b4c12bf4c3ed4fcf2

See more details on using hashes here.

File details

Details for the file pyChainable-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyChainable-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pyChainable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e7ee2c501a77e777045eaa734386de0124fc6f58ca80069c40a8043a2c1de2
MD5 45036f3782e24632d283d5fa90d81eef
BLAKE2b-256 da5d8137aba78cd13894451bbeb1733b20bcb32258c2c08ce56d9152799db617

See more details on using hashes here.

Supported by

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