Python decorator library that adds customizeable dunder methods to decorated classes.
Project description
By Andy Stokely
Python decorator library that adds customizeable dunder methods to decorated classes. This both decreases the amount of code that is normally required to implement dunder methods, and also helps reduce repitition when coding classes that use custom dunder methods with the same or similar code. Right now, the following dunder methods have corresponding dunder decorators:
__iter__ (dunder_iter) __setitem__ (dunder_setitem) __getitem__ (dunder_getitem) __missing__ (dunder_missing) __repr__ (dunder_repr)
If a dunder decorator is used without any parameters, it defines the special method with respect to the class object’s dictionary. However, the user is able to have the special method defined with repsect to one of the class object’s attributes by setting the attr parameter equal to the name of the attribute. Dunder decorators can also be used with classes that use __slots__, rather then a dictionary to store object attributes, by setting the slots parameter to True. For specific examples, see the examples in the dunder_decorator.py doc-strings.
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
Built Distribution
File details
Details for the file dunderdecorators-1.0.0.tar.gz
.
File metadata
- Download URL: dunderdecorators-1.0.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85318164ef6e8d513bf8bdaa686fcc5d68d90a10ce69024e1436864c27f7e5a5 |
|
MD5 | bd7654d9390b3c6e27a4a7b437b61a05 |
|
BLAKE2b-256 | af7b2cec27f060cf245f6b3eb8d5f825cb57e9f8d02914d3453aa7c9453c4575 |
File details
Details for the file dunderdecorators-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: dunderdecorators-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 259957567c19c2a8ea25e441722f94773ab7813b90b47baf7bcad6310636aa27 |
|
MD5 | c4f8bf8048a792be9f57e36d0d111110 |
|
BLAKE2b-256 | 4791f5fe236ed8162d883adc557e41bf88b861c4925f554fd07dece25381b2a2 |