Added simple user guide in README.

This commit is contained in:
Andrey Popp 2010-07-16 18:37:31 +04:00
parent caf5987cb9
commit ab854e9fdd

View File

@ -1,5 +1,5 @@
Generic -- programming library for Python
=========================================
Generic programming library for Python
======================================
Generic is trying to be simple and easy-to-use programming library that
features the following:
@ -10,3 +10,29 @@ features the following:
* Event system (not implemented).
Its development takes place at http://githib.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: ...