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.

Source Distribution

generic-0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

generic-0.1-py2.6.egg (15.9 kB view details)

Uploaded Source

File details

Details for the file generic-0.1.tar.gz.

File metadata

  • Download URL: generic-0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for generic-0.1.tar.gz
Algorithm Hash digest
SHA256 c34eb6911cad6f3703aac8ab4af6eb2dd9b4bb411938b847f3ad3bb9d46950bd
MD5 9343463e2f5ee79c2735b453ff912d18
BLAKE2b-256 9d0b23863a3875a915e279e66de9562ceec46293f10c579dccd0af6567f3eae2

See more details on using hashes here.

File details

Details for the file generic-0.1-py2.6.egg.

File metadata

  • Download URL: generic-0.1-py2.6.egg
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for generic-0.1-py2.6.egg
Algorithm Hash digest
SHA256 0ec224e434c63e3b06ebe1dce88f25d85d612e0f70fb34a26317493de1cc4e26
MD5 0471d3fbccc79baaf5a0d891bdfad32c
BLAKE2b-256 3eef047898f3e48ed8a135ff2b35bd759f6a8af00e84bf7565dc9709900d63a4

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