• Python自然语言处理学习笔记(37):4.9 小结


    4.9   Summary 小结

    • Python's assignment and parameter passing use object references; e.g. if a is a list and we assign b = a, then any operation on a will modify b, and vice versa.
    • Python的赋值和传参使用了对象引用;例如,如果a是一个列表并且我们赋值b=a,那么任何对于a的操作将会修改b 的值,反之亦然。
    • The is operation tests if two objects are identical internal objects, while == tests if two objects are equivalent. This distinction parallels the type-token distinction.
    • is操作符测试两个对象是否为同一对象,而==测试两个对象的值是否相等。这区别相对应标记类型的区分。
    • Strings, lists and tuples are different kinds of sequence object, supporting common operations such as indexing, slicing, len(), sorted(), and membership testing using in.
    • 字符串,列表和元组是不同种类的序列对象,支持如indexing, slicing, len(), sorted()以及成员测试in等一般操作。
    • We can write text to a file by opening the file for writing ofile = open('output.txt', 'w'), then adding content to the file ofile.write("Monty Python"), and finally closing the file ofile.close().
    • 通过打开文件用以写入ofile = open('output.txt', 'w')的方式,我们可以将文本写入到文件,然后增加内容到文件ofile.write("Monty Python"),最后关闭文件ofile.close().
    • A declarative programming style usually produces more compact, readable code; manually-incremented loop variables are usually unnecessary; when a sequence must be enumerated, use enumerate().
    • 声明式编程风格常常产生更简洁,可读性更好的代码;手动增加的循环变量常常是不需要得;当一个序列必须被枚举时,使用enumerate()
    • Functions are an essential programming abstraction: key concepts to understand are parameter passing, variable scope, and docstrings.
    • 函数是一个基本的编程抽象:主要概念要理解传参,变量范围,文档字符串。
    • A function serves as a namespace: names defined inside a function are not visible outside that function, unless those names are declared to be global.
    • 函数作为一个名称空间:在函数内部定义的名称从外部不能访问,除非那些成为被声明为global
    • Modules permit logically-related material to be localized in a file. A module serves as a namespace: names defined in a module — such as variables and functions — are not visible to other modules, unless those names are imported.
    • 模块允许逻辑相关的材料被放置在一个文件内。模块作为一个名称空间:定义在模块中的名称—诸如变量和函数—对于其他模块来说是不可见的,除非这些名称被导入。
    • Dynamic programming is an algorithm design technique used widely in NLP that stores the results of previous computations in order to avoid unnecessary recomputation.
    • 动态编程是广泛地应用在NLP中的一个算法设计技术,它存储先前计算结构以避免不必要的重新计算。

  • 相关阅读:
    base 镜像
    最小的镜像
    Docker 组件如何协作?- 每天5分钟玩转容器技术(8)
    Docker 架构详解
    容器 What, Why, How
    【视频或者图文】运行第一个容器
    运行第一个容器
    [原]关于helios自定义面板简述
    [osg]osg背景图设置
    [qt]qstring和string中文支持转换问题
  • 原文地址:https://www.cnblogs.com/yuxc/p/2147847.html
Copyright © 2020-2023  润新知