`

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

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics