Functional Programming in Python

Functional Programming in Python

简介:

Python不是一种函数式编程语言,但它是一种多范式语言,使函数式编程易于执行,并且易于与其他编程风格混合。在本文中,Python软件基金会的董事David Mertz研究了该语言的功能方面,并指出了哪些选项效果很好,哪些选项通常应该拒绝。

Mertz描述了如何避免Python的命令式流控制,可调用函数的细微差别,如何懒惰地使用迭代器,以及使用高阶函数。他还列出了几个对函数式编程有用的第三方Python库。

主题包括:

使用封装和其他手段来描述数据集合由 “什么” 组成,而不是 “如何” 构造数据集合使用命名函数、lambdas、闭包、类的方法和多个调度创建可调用对象使用Python的迭代器协议来实现与惰性数据结构相同的效果创建将函数作为参数和/或生成函数作为结果的高阶函数

英文简介:

Python is not a functional programming language, but it is a multi-paradigm language that makes functional programming easy to perform, and easy to mix with other programming styles. In this paper, David Mertz, a director of Python Software Foundation, examines the functional aspects of the language and points out which options work well and which ones you should generally decline.

Mertz describes ways to avoid Python's imperative-style flow control, the nuances of callable functions, how to work lazily with iterators, and the use of higher-order functions. He also lists several third-party Python libraries useful for functional programming.

Topics include:

Using encapsulation and other means to describe "what" a data collection consists of, rather than "how" to construct a data collectionCreating callables with named functions, lambdas, closures, methods of classes, and multiple dispatchUsing Python’s iterator protocol to accomplish the same effect as a lazy data structureCreating higher-order functions that take functions as arguments and/or produce a function as a result

书名
Functional Programming in Python
译名
Python 中的函数式编程
语言
英语
年份
2015
页数
49页
大小
1.56 MB
标签
  • 函数式编程
  • Python
  • 下载
    pdf iconFunctional Programming in Python.pdf
    密码
    65536

    最后更新:2025-04-12 23:54:38

    ←Data Structures and Algorithms in Python

    →Learning the Pandas Library: Python Tools for Data Munging, Analysis, and Visualization