Python 函数式编程工具箱 Toolz

码农软件 · 软件分类 · 常用工具包 · 2019-08-15 17:57:44

软件介绍

Toolz 是 Python 的函数式编程工具箱。Toolz 支持 Python 2.6+ 和 Python 3.3+。

Toolz 的实现包括三部分:

  • itertoolz,for operations on iterables. 例如:groupby,unique, interpose,

  • functoolz, for higher-order functions. 例如:memoize,curry, compose

  • dicttoolz, for operations on dictionaries. 例如:assoc,update-in, merge.

示例:

>>> def stem(word):
...     """ Stem word to primitive form """
...     return word.lower().rstrip(",.!:;'-\"").lstrip("'\"")
>>> from toolz import compose, frequencies, partial
>>> wordcount = compose(frequencies, partial(map, stem), str.split)
>>> sentence = "This cat jumped over this other cat!"
>>> wordcount(sentence)
{'this': 2, 'cat': 2, 'jumped': 1, 'over': 1, 'other': 1}

本文地址:https://codercto.com/soft/d/12436.html

The Algorithm Design Manual

The Algorithm Design Manual

Steve S. Skiena / Springer / 1998-8-1 / GBP 53.91

Contents u Techniques u Introduction to Algorithms u Correctness and Efficiency u Correctness u Efficiency u Expressing Algorithms u Keeping Score u The RAM Model of Computatio......一起来看看 《The Algorithm Design Manual》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器