函数式编程是什么?Python 是否支持?如何在 Python 中实现?
What is functional programming? Does Python follow a functional programming style? If yes, list a few methods to implement functionally oriented programming in Python.
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: hard
分类: functional-programming
标签: python, functional, map, filter, reduce
参考答案摘要
TL;DR 函数式编程强调用纯函数和不可变数据构建逻辑;Python 支持函数式风格,可用 map / filter / reduce 、lambda、生成器等。 常用方式 map() filter() functools.reduce() lambda / list comprehension / generator from functools import reduce nums = [1,...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。