Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dunderdecorators-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

dunderdecorators-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for dunderdecorators-1.0.0.tar.gz
Algorithm Hash digest
SHA256 85318164ef6e8d513bf8bdaa686fcc5d68d90a10ce69024e1436864c27f7e5a5
MD5 bd7654d9390b3c6e27a4a7b437b61a05
BLAKE2b-256 af7b2cec27f060cf245f6b3eb8d5f825cb57e9f8d02914d3453aa7c9453c4575

See more details on using hashes here.

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

Hashes for dunderdecorators-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 259957567c19c2a8ea25e441722f94773ab7813b90b47baf7bcad6310636aa27
MD5 c4f8bf8048a792be9f57e36d0d111110
BLAKE2b-256 4791f5fe236ed8162d883adc557e41bf88b861c4925f554fd07dece25381b2a2

See more details on using hashes here.

Supported by

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