Skip to main content

A set of tools for generic programming.

Project description

Generic is trying to be simple and easy-to-use programming library that features the following:

  • Multidispatching mechanisms for functions and methods (latter is not implemented yet).
  • Registries with different and user-defined lookup strategies.
  • Event system (not implemented).

Its development takes place at http://github.com/andreypopp.

Multidispatching

Generic library provides way to define function with multidispatching feature:

from generic.multidispatching import multifunction

@multifunction(int, int)
def add(x, y):
    return x + y

@add.when(str, str)
def add(x, y):
    return add(int(x), int(y))

And then in console:

>>> add(1, 2)
3
>>> add("1", "2")
3
>>> add("1", 2)
Traceback
...
TypeError: ...

Project details


Download files

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

Files for generic, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size generic-0.1-py2.6.egg (15.9 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size generic-0.1.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page