1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        ToolzPython 函數(shù)式編程工具箱

        聯(lián)合創(chuàng)作 · 2023-09-28 13:21

        Toolz 是 Python 的函數(shù)式編程工具箱。Toolz 支持 Python 2.6+ 和 Python 3.3+。

        Toolz 的實現(xiàn)包括三部分:

        • 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}
        瀏覽 21
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            欧美日韩日逼 | www.啊啊啊啊 | 福利一区二区三区四区 | 天天尻| 久操视频免费 | 欧洲美妇做爰 | 久久综合电影 | 91三级在线 | 扒开老师狂揉看漫画 | 手机在线无码视频 |