盘点一下编程中的常见术语。方便大家记忆,建议整理收藏。
1.deterministic: Pertaining to a program that does the same thing each time it runs, given the
same inputs.
确定性:给定同样的输出,程序每次运行结果都相同。
2.pseudorandom: Pertaining to a sequence of numbers that appears to be random, but is
generated by a deterministic program.
假随机数:一段数字序列中的数,看上去似乎是随机的,但实际上也是由确定的算法来生成的。
3.default value: The value given to an optional parameter if no argument is provided.
默认值:如果不对可选参数进行赋值的话,该参数会用默认设置的值。
override: To replace a default value with an argument.
覆盖:用户在调用函数的时候给可选参数提供了参数,这个参数就覆盖掉默认值。
4.benchmarking: The process of choosing between data structures by implementing
alternatives and testing them on a sample of the possible inputs.
persistent: Pertaining to a program that runs indefinitely and keeps at least some of its data
in permanent storage.
持久性:指一个程序可以随时运行,然后可以存储一部分数据到永久介质中。
5.format operator: An operator, %, that takes a format string and a tuple and generates a
string that includes the elements of the tuple formatted as specified by the format string.
格式运算符: % 运算符,处理字符串和元组,然后生成一个包含元组中元素的字符串,根据给定的格式字符串进行格式化。
6.format string: A string, used with the format operator, that contains format sequences.
格式字符串:用于格式运算符的一个字符串,内含格式序列。
7.format sequence: A sequence of characters in a format string, like %d, that specifies how a
value should be formatted.
格式序列:格式字符串内的一串字符,比如 %d ,规定了一个值如何进行格式化。
8.text file: A sequence of characters stored in permanent storage like a hard drive.
文本文件:磁盘中永久存储的一个文件,内容为一系列的字符。
9.directory: A named collection of files, also called a folder.
目录:有名字的文件集合,也叫做文件夹。
10.path: A string that identifies a file.
路径:指向某个文件的字符串。
11.relative path: A path that starts from the current directory.
相对路径:从当前目录开始,到目标文件的路径。
12.absolute path: A path that starts from the topmost directory in the file system.
绝对路径:从文件系统最底层的根目录开始,到目标文件的路径。
13.catch: To prevent an exception from terminating a program using the try and except
statements.
抛出异常:为了避免意外错误中止程序,使用 try 和 except 语句来处理异常。
14.database: A file whose contents are organized like a dictionary with keys that correspond to
values.
数据库:一个文件,全部内容以类似字典的方式来组织,为键与对应的键值。
15.bytes object: An object similar to a string.
二进制对象:暂时就当作是根字符串差不多的对象就可以了。
16.shell: A program that allows users to type commands and then executes them by starting
other programs.
shell:一个程序,允许用户与操作系统进行交互,可以输入命令,然后启动一些其他程序来执行。
17.pipe object: An object that represents a running program, allowing a Python program to run
commands and read the results.
管道对象:代表了一个正在运行的程序的对象,允许一个 Python 程序运行命令并读取运行结果
18.prototype and patch: A development plan that involves writing a rough draft of a program,
testing, and correcting errors as they are found.
原型和补丁模式:一种开发模式,先写一个程序的草稿,然后测试,再改正发现的错误,这样逐步演化的开发模式。
19.designed development: A development plan that involves high-level insight into the problem
and more planning than incremental development or prototype development.
设计规划开发:这种开发模式要求对所面对问题的高程度的深刻理解,相比渐进式开发和原型增补模式要更具有计划性。
20.pure function: A function that does not modify any of the objects it receives as arguments.
Most pure functions are fruitful.
纯函数:不修改参数对象的函数。这种函数多数是有返回值的函数。
21.modifier: A function that changes one or more of the objects it receives as arguments. Most
modifiers are void; that is, they return None.
修改器:修改参数对象的函数。大多数这样的函数都是无返回值的,也就是返回的都是None 。
22.functional programming style: A style of program design in which the majority of functions
are pure.
函数式编程模式:一种程序设计模式,主要特征为大多数函数都是纯函数。
23.invariant: A condition that should always be true during the execution of a program.
约束条件:在程序运行过程中,应该一直为真的条件。
24.assert statement: A statement that check a condition and raises an exception if it fails.
assert 语句:一种检查错误的语句,检查一个条件,如果不满足就抛出异常。
25.object-oriented language: A language that provides features, such as programmer-defined
types and methods, that facilitate object-oriented programming.
面向对象的编程语言:提供面向对象功能的语言,比如用户自定义类型和方法,有利于实现面向对象编程。
26.object-oriented programming: A style of programming in which data and the operations that
manipulate it are organized into classes and methods.
面向对象编程:一种编程模式,数据和运算都被封装进类和方法之中。
27.method: A function that is defined inside a class definition and is invoked on instances of that
class.
方法:类内所包含的函数就叫方法,可以在类的接口中被调用。
28.subject: The object a method is invoked on.
主语:调用方法的对象。
29.positional argument: An argument that does not include a parameter name, so it is not a
keyword argument.
位置参数:一种参数,没有参数名字,不是关键字参数。
30.operator overloading: Changing the behavior of an operator like + so it works with a
programmer-defined type.
运算符重载:像 + 加号这样的运算符,在处理用户自定义类型的时候改变为相应的运算。
31.type-based dispatch: A programming pattern that checks the type of an operand and invokes
different functions for different types.
按类型处理:一种编程模式,检查运算数的类型,然后根据类型调用不同的函数来进行运算。
32.polymorphic: Pertaining to a function that can work with more than one type.
多态:一个函数能处理多种类型的特征,就叫做多态。
33.information hiding: The principle that the interface provided by an object should not depend
on its implementation, in particular the representation of its attributes.
信息隐藏:一种开发原则,一个对象提供的接口应该独立于其实现,尤其是不受对象属 性设置变化的影响。