Skip to main content

The Trojan Rabbit

A collection of python extras (and an hommage to Monty Python's Holy Grail)

Decorator @dynamicmethod

This decorator provides the missing option for method definitions:

| decorator           | 1st parameter passed when called from |
|                     | instance / class                      |
|---------------------+---------------------------------------|
| - (instance method) | instance / None                       |
| @classmethod        | class    / class                      |
| @staticmethod       | -        / -                          |
| @dynamicmethod      | instance / class                      |

Usage

from trojan_rabbit.dynamicmethod import dynamicmethod


class Knight:
    description = "a knight of the Round Table"

    def __init__(self, name, attribute):
        self.name = name
        self.attribute = attribute

    @dynamicmethod
    def whoami(caller):
        if isinstance(caller, Knight):
            print(f"{caller.attribute.capitalize()} Sir {caller.name}", end=', ')
        print(caller.description)


robin = Knight("Robin", "brave")

Knight.whoami
# output: <bound method Knight.whoami of <class '__main__.Knight'>>

robin.whoami
# output: <bound method Knight.whoami of <__main__.Knight object at 0x7f377073fe50>>

Knight.whoami()
# output: a knight of the Round Table

robin.whoami()
# output: Brave Sir Robin, a knight of the Round Table

Metadata

Release files for trojan-rabbit 0.0.1

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

Source distribution (sdist)

Source distribution for trojan-rabbit 0.0.1
File Size Uploaded Provenance Actions
trojan_rabbit-0.0.1.tar.gz 2.8 kB Without provenance Details for trojan_rabbit-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trojan-rabbit 0.0.1
File Interpreter ABI Platform Actions
trojan_rabbit-0.0.1-py3-none-any.whl Python 3 none any Details for trojan_rabbit-0.0.1-py3-none-any.whl

Total release size: 6.0 kB

Release files / trojan_rabbit-0.0.1.tar.gz

Download URL trojan_rabbit-0.0.1.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4668b023a58f89055eaf9105a29b0a03e1dc367fc416df0c30781db190b328e7
BLAKE2b-256 checksum
How to use checksums
396c6e5e7d366f7b08c21e46940aed221610dcfa35cfb3ef0f84cf8211643fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / trojan_rabbit-0.0.1-py3-none-any.whl

Download URL trojan_rabbit-0.0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1bf29b014b1feb634ed29b9df7017b4377785aa0cb2208ba5b627d031f5db1e
BLAKE2b-256 checksum
How to use checksums
48f897e1f607e61f3e33c8e094c3c445f829151c9470ad1b254bfa111927d855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for trojan-rabbit 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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