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.
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
0.8.1-bp156.3.1 info | GA Release | 2023-07-22 | 15 SP6 |
|
|
0.8.1-bp155.2.13 info | GA Release | 2023-05-22 | 15 SP5 |
|
|
0.8.1-bp154.1.91 info | GA Release | 2022-05-09 | 15 SP4 |
|
|
0.8.1-bp153.1.21 info | GA Release | 2021-03-05 | 15 SP3 |
|
|
0.8.1-bp152.4.14 info | GA Release | 2020-04-16 | 15 SP2 |
|
|
0.8.1-bp151.3.1 info | GA Release | 2019-07-16 | 15 SP1 |
|
|
0.8.1-bp151.2.11 info | GA Release | 2019-05-18 | 15 SP1 |
|
|
0.8.1-bp150.2.4 info | GA Release | 2018-07-30 | 15 |
|
|