2

是否有用于构建 python 模块内容的 PEP 或一般约束约定?我目前的结构像

  1. 模块文档
  2. 元变量(__all__、__author__、__version__、...)
  3. 包括
  4. 模块方法
  5. 班级

看起来像这样(这里没有模块方法):

"""
Generic clients

This package contains abstract, generic clients for foreign-API interaction.
Please see the client's documentation for advises for implementation. 
"""
__date__ = "16.07.2014"
__author__ = "My Name <me@company.com>"
__all__ = ['ImportClient',
           'ExportClient',
           'IEClient', 
           'CRUDClient']

from .abc import CustomerAwareConfigurableSlaveLog
from ..config import Config
import pyopenimmo as OpenImmo
from abc import abstractmethod

class ImportClient(CustomerAwareConfigurableSlaveLog):
    """
    Generic client that can import OpenImmo data
    """
    @abstractmethod
    def import_(self, openimmo):
        """
        Imports OpenImmo data from API
        """
        pass


class ExportClient(CustomerAwareConfigurableSlaveLog):
    """
    Generic client that can export OpenImmo data
    """
    @abstractmethod
    def export(self, openimmo): #@UnusedVariable
        """
        Exports OpenImmo data to API
        """
        return
<snip>

这对我来说似乎很可行,但我也希望其他人发现我的代码易于理解。

4

0 回答 0