Skip to main content

CLOS-style generic functions with annotation based syntax

Project description

PyCLOS implements CLOS-style generic functions for Python 3. Current implementation is pure python with optional dependency on C implemented lru-dict which gets used for dispatch caches in case of specialization on value.

Example usage:

from py_clos import generic
@generic
def display(what, where):
    return "{} on {}".format(what, where)

@generic.around
def display(what, where: Webpage, next_method):
    return "<html>{}</html>".format(next_method(what, where))

@generic
def display(what: User, where):
    return "user"

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

PyCLOS-0.2.tar.gz (5.4 kB view hashes)

Uploaded Source

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