openai baselines/logger.py 分析学习

python3 自动继承 object 这个 class

[‘class‘, ‘delattr‘, ‘dir‘, ‘doc‘, ‘eq‘, ‘format‘, ‘ge‘, ‘getattribute‘, ‘gt‘, ‘hash‘, ‘init‘, ‘le‘, ‘lt‘, ‘ne‘, ‘new‘, ‘reduce‘, ‘reduce_ex‘, ‘repr‘, ‘setattr‘, ‘sizeof‘, ‘str‘, ‘subclasshook‘]

(待更:这些 attribute 的用法)

一个 object 就是某个 class 的 instance

怎么写一个 logger 模块

python log 从小白到入门

Python isinstance () 函数:判断 A 是否是 B 类型,输出 True 或 False

isinstance () 与 type () 区别:
type () 不会认为子类是一种父类类型,不考虑继承关系。
isinstance () 会认为子类是一种父类类型,考虑继承关系。

四种 python 底线命名

1.foo_

避免与 Python 的 built-in keywords 或 built-in functions 取一样的名字

2._foo

不希望他直接被访问

3.foo

Never invent such names; only use them as documented.

4.__foo

you have attributes that you do not want subclasses to use
(Python)底線 介紹!(轉錄)