python的类注释是可以通过代码访问的,这样非常利于书写说明文档
class Foo: pass class Bar: """Representation of a Bar""" pass assert Foo.__doc__ == None assert Bar.__doc__ == "Representation of a Bar"
python的类注释是可以通过代码访问的,这样非常利于书写说明文档
class Foo: pass class Bar: """Representation of a Bar""" pass assert Foo.__doc__ == None assert Bar.__doc__ == "Representation of a Bar"