Skip to content

Python3中文文档改进提议:语言参考3.3.1节 #152

@Z-2ez4U

Description

@Z-2ez4U

(第1段开头)Called when the instance is about to be destroyed. This is also called a finalizer or (improperly) a destructor.

(CPython实现细节那段)CPython implementation detail: It is possible for a reference cycle to prevent the reference count of an object from going to zero. In this case, the cycle will be later detected and deleted by the cyclic garbage collector. A common cause of reference cycles is when an exception has been caught in a local variable. The frame’s locals then reference the exception, which references its own traceback, which references the locals of all frames caught in the traceback.

  • 原始译文

(第1段开头)在实例将被销毁时调用。这还会调用终结器或析构器 (不适当)。

(CPython实现细节那段)【本段未被翻译】

  • 改进提议

(第1段开头)在实例将被销毁时调用。这还被称为终结器或析构器 (不适当)。

(CPython实现细节那段)CPython implementation detail: 引用循环可能妨碍一个对象的引用计数归零。这种引用循环稍后会被循环垃圾回收器所检测并删除。引用循环常发生在一个异常被某一局部变量捕获时。然后,执行帧的局部变量引用了该异常,该异常引用了其自身的回溯对象,后者再引用了它捕获的所有执行帧的局部变量。

  • 提议原因

(第1段开头)第2句中的”call“为被动语态,非”调用“之意,否则会是“This also calls…”。

(CPython实现细节那段)贡献一版译文。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions