Skip to main content

Delegate

A python library for delegation (the metaprogramming feature)

This library adds the @delegate decorator which may be used to delegate attributes from an attribute of the existing class. For example:

from delegate import delegate

class Parent:
    def __init__(self):
        self.a = "a"
        self.b = "b"
        self.d = "d"

# The delegate decorator makes .a and .b available on Child, through its
# "parent" attribute, as though Child had an a and b attribute itself.
@delegate("a", "b", to="parent")
class Child:
    def __init__(self):
        self.parent = Parent()
        self.c = "c"

instance = Child()
assert instance.a == "a"
raised = False
try:
    # But d is not available
    instance.d
except e:
    raised = True

assert raised

Release files for delegate-property 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for delegate-property 0.1.0
File Size Uploaded
delegate_property-0.1.0.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for delegate-property 0.1.0
File Interpreter ABI Platform
delegate_property-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 kB

Release files / delegate_property-0.1.0.tar.gz

Download URL delegate_property-0.1.0.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52f2ab303b187e16c391356b114c69f410ff84560e0444ea8206f3196c08ffab
BLAKE2b-256 checksum
How to use checksums
0f27e752d3c4fbcb1ccf4fd590014a0d7558b779501e3c993143a4cccc990457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / delegate_property-0.1.0-py3-none-any.whl

Download URL delegate_property-0.1.0-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf9628e14984abbb425f53f203bad6c586aa9daa2a1227b09ddc277cc51cb28d
BLAKE2b-256 checksum
How to use checksums
3ac7dc178d42c3bf2b30d4cb4e7fc2a82097e6b136636f28856a16c173296c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page