Skip to main content

Aspect-oriented programming

Project description

Advice

Aspect-oriented programming

Usage

import advice


def multiply(context):
    print(context.args)
    print(context.kwargs)
    yield
    context.result *= 100


advice.register(
    handler=multiply,
    modules=advice.match(equals='math'),
    targets=advice.match(regexp='(sin|cos)')
)

Ok, let's check:

In [2]: import math

In [3]: math.cos(0)
(0,)
{}
Out[3]: 100.0

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

advice-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file advice-0.1.0.tar.gz.

File metadata

  • Download URL: advice-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for advice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 034ba1b4828fd60e0b6bf48fc6dafd76d15162da2ceb962865dbb1ed84794e5e
MD5 54d9c5e336a8544cf161161c39a99104
BLAKE2b-256 3e1d34f2af428082f75340dbc7e4d3eb35a65c1291d2c8117a5f1ea7ab0cda33

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