Abstraction and Structure——《Learning Python》抽象之函数
来源:互联网 发布:深入浅出 python 中文 编辑:程序博客网 时间:2024/04/30 12:59
Abstraction and Structure
Abstraction can be useful as a labor saver, but it is actually more important than that. It is the key to making computer programs understandable to humans (which is essential, whether you’re writing them or reading them). The computers themselves are perfectly happy with very concrete and specific instructions, but humans generally aren’t.
Now, if I instead told you to “Walk down this street until you get to a bridge, cross the bridge, and the cinema is to your left,” you would certainly understand me. The point is that you already know how to walk down the street and how to cross a bridge. You don’t need explicit instructions on how to do either.
Your programs should be quite abstract, as in “Download page, compute frequencies, and print the frequency of each word.” This is easily understandable.
Creating Your Own Functions
def hello(name): return 'Hello, ' + name + '!'
Documenting Functions
def square(x): 'Calculates the square of the number x.' return x*xThe docstring may be accessed like this:>>> square.__doc__'Calculates the square of the number x.'
- Abstraction and Structure——《Learning Python》抽象之函数
- Python抽象之函数
- Python学习教程(六)——抽象之函数
- Python Algorithms Learning Notes(2)—Implementing Graphs and Trees
- Scala函数式程序设计原理 week3 Data and Abstraction
- Abstraction and function pointers
- Python学习随笔五:抽象之函数
- Unsupervise learning——Unsupervised feature learning and deep learning
- 机器学习之无监督特征学习——Unsupervised feature learning and deep learning
- Beginning Python - Chapter6 : Abstraction
- 数据结构之图 Data Structure — graph
- 资源向导之 "Data structure and Algorithm"
- leetcode——Add and Search Word - Data structure design
- learning Python-Tuple and files
- machine learning : 最小二乘法之线性函数 --- python实现
- [Python for Data Analysis]Python Basic2--Data Structure and Sequences
- 数据结构(C++) Data Structure learning——第一章 线性表(SEC01)
- python基础知识---抽象--函数
- javascript基础
- android沉浸式状态栏
- 图片加载框架-Fresco
- Java解码网站post字符串(swich case用法和乱码判断)
- android-----UI布局之TabHost与TextView
- Abstraction and Structure——《Learning Python》抽象之函数
- 多线程编程
- 过滤器知识总结
- Android学习笔记(九):按钮添加点击事件的4种方式
- apache启动脚本
- android(SignalA)接收.net(SignalR)推送过来的消息
- JavaWeb多种乱码解决方法
- css:display的属性选择
- swap关于指针的使用