依然饭跑跑 发表于 2017-5-3 10:58:37

Python an practical example of writing doc string

  writing docs string is start of becoming a professional python developer.
  the article is based on the article here:  http://stackoverflow.com/questions/256222/which-exception-should-i-raise-on-bad-illegal-argument-combinations-in-python
  


def import_to_orm(name, save=False, recurse=False):
"""
:param name: Name of some external entity to import.
:param save: Save the ORM object before returning.
:param recurse: Attempt to import associated objects as well. Because you
need the original object to have a key to relate to, save must be
`True` for recurse to be `True`.
:raise BadValueError: If `recurse and not save`.
:return: The ORM object.
"""
pass
页: [1]
查看完整版本: Python an practical example of writing doc string