Surround top-level function and class definitions with two blank lines.
Method definitions inside a class are surrounded by a single blank line.
Extra blank lines may be used (sparingly) to separate groups of related functions. Blank lines may be omitted between a bunch of related one-liners (e.g. a set of dummy implementations).
Use blank lines in functions, sparingly, to indicate logical sections.
这被认为是一种很好的做法。根据PEP-0008 document:
PEP-8是Python代码的样式指南
相关问题 更多 >
编程相关推荐