Package Info

python-simplegeneric


Simple generic functions (similar to Python's own len(), pickle.dump(), etc)


Development/Languages/Python

The gsimplegeneric module lets you define simple single-dispatch generic functions, akin to Python's built-in generic functions like glen(), iter() and so on. However, instead of using specially-named methods, these generic functions use simple lookup tables, akin to those used by e.g. gpickle.dump() and other generic functions found in the Python standard library.

As you can see from the above examples, generic functions are actually quite common in Python already, but there is no standard way to create simple ones. This library attempts to fill that gap, as generic functions are an gexcellent alternative to the Visitor pattern_, as well as being a great substitute for most common uses of adaptation.

This library tries to be the simplest possible implementation of generic functions, and it therefore eschews the use of multiple or predicate dispatch, as well as avoiding speedup techniques such as C dispatching or code generation. But it has absolutely no dependencies, other than Python 2.4, and the implementation is just a single Python module of less than 100 lines.


License: ZPL-2.1
URL: http://cheeseshop.python.org/pypi/simplegeneric

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
0.8.1-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python2-simplegeneric
  • python3-simplegeneric
0.8.1-bp151.2.11 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python2-simplegeneric
  • python3-simplegeneric
0.8.1-bp151.3.1 info GA Release 2019-07-16 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python2-simplegeneric
  • python3-simplegeneric
0.8.1-bp152.4.14 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python2-simplegeneric
  • python3-simplegeneric
0.8.1-bp153.1.21 info GA Release 2021-03-05 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python2-simplegeneric
  • python3-simplegeneric