OverviewThis project consists of functional programming tools for Python. The source code can be found on github. The Ohloh project page is located here.Pattern Matching Function DispatchThis functionality is inspired from Erlang.With pyfnc, the example above would translate to the following: Functional dictionaryWouldn't it be nice to chain operations on dictionaries?>>> from pyfnc import dic >>> d=dic() >>> d.update(other_dic).get(some_key, some_default) Another example: >>> from pyfnc import dic >>> d=dic() >>> value=d.update(other_dic).all( lambda key, value: (key.lower(), value.lower()) )["this_key"] Functional listWouldn't it be nice to chain operations on lists?>>> from pyfnc import liste >>> l=liste() >>> l.extend(other_list).map(some_function) Another example: >>> from pyfnc import liste >>> l=liste(some_list) >>> count_even=l.count(lambda x:x%2==0) More examplesMore examples can be found by perusing the unittest here. |
Docs > OpenSource >