官术网_书友最值得收藏!

Preface

Functional programming offers a variety of techniques for creating succinct and expressive software. While Python is not a purely functional programming language, we can do a great deal of functional programming in Python.

Python has a core set of functional programming features. This lets us borrow many design patterns and techniques from other functional languages. These borrowed concepts can lead us to create succinct and elegant programs. Python's generator expressions, in particular, negate the need to create large in-memory data structures, leading to programs that may execute more quickly because they use fewer resources.

We can’t easily create purely functional programs in Python. Python lacks a number of features that would be required for this. We don’t have unlimited recursion, for example, we don’t have lazy evaluation of all expressions, and we don’t have an optimizing compiler.

There are several key features of functional programming languages that are available in Python. One of the most important ones is the idea of functions being first-class objects. Python also offers a number of higher-order functions. The built-in map(), filter(), and functools.reduce() functions are widely used in this role, and less-obvious are functions such as sorted(), min(), and max().

We’ll look at the core features of functional programming from a Python point of view. Our objective is to borrow good ideas from functional programming languages and use those ideas to create expressive and succinct applications in Python.

主站蜘蛛池模板: 图们市| 鄂伦春自治旗| 德清县| 克山县| 武冈市| 九龙城区| 陵川县| 双江| 嫩江县| 嘉荫县| 北京市| 玉林市| 长垣县| 乌兰察布市| 七台河市| 石河子市| 岳阳市| 绍兴县| 崇信县| 集贤县| 鄄城县| 阆中市| 芜湖县| 灵石县| 沽源县| 古丈县| 麻栗坡县| 齐齐哈尔市| 盐源县| 五华县| 富顺县| 革吉县| 德兴市| 昌黎县| 环江| 平顶山市| 西宁市| 义马市| 静乐县| 丁青县| 溧水县|