简体   繁体   中英

Documenting attributes of abstract base classes?

I have an abstract base class, and every descendant is expected to have certain attributes (of type str, int, etc), hence it makes sense to document those attributes in the base class. What is the recommended format for documenting these attributes in Python 3.6+?

The best source might be PEP 257, specifically the guidance on subclassing.

From PEP 257

The docstring for a class should summarize its behavior and list the public methods and instance variables. If the class is intended to be subclassed, and has an additional interface for subclasses, this interface should be listed separately (in the docstring). The class constructor should be documented in the docstring for its init method. Individual methods should be documented by their own docstring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM