Skip to main content

Tool for writing simple decorators

Project description

Decorum is a simple tool which aims to make it easier to write flexible and simple decorators. It can also act similarly to functools.wraps.

Typical usage looks like this:

from decorum import decorator

class my_decorator(decorator):
def wraps(self, f):

print “I’m returning the function! You can keep it!” return f

Decorum makes lets you write decorators in a unified way. Your decorator can be used with or without arguments, and it will work the same way.

@my_decorator def foo(x): print x

Is identical to:

@my_decorator() def foo(x): print x

Writing decorators

There are two many methods you’ll want to use in your subclassed decorators. Customize wraps to handle the decoration, and return (or not) the wrapped function, and use init to handle any optional arguments.

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

Decorum-0.2.tar.gz (1.4 kB view details)

Uploaded Source

File details

Details for the file Decorum-0.2.tar.gz.

File metadata

  • Download URL: Decorum-0.2.tar.gz
  • Upload date:
  • Size: 1.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Decorum-0.2.tar.gz
Algorithm Hash digest
SHA256 eb75ed12f53a6d6bd486269981b7729b243f896b9e777b3e480bdfca66e060f2
MD5 25cbe5dc1153c624279b9e137e08aa3b
BLAKE2b-256 ae81ed203cbafe4b2c5ebf92f495e89058082a01a82f5d33aaa1cb0d5d2587bb

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