Python: Standard way to denote return and parameter types -


Is there a standard, pathological way to express the parameter type and the type of function back?

I am looking for a notation:

  • help
  • can be identified by IDE <
  • (Preferrably) described in PEP

    I have seen some examples like:

      "" " Varies with: Ultimate Timestamp: Formatted Date Display: Type Timestamp: Str or Unicode: Ultimate Priority: Priority Number: Type Priority: str or Unicode: Ultimate Priority_name: Priority G: type preference name: str or unicode: the ultimate message: to display message: type message: str or unicode: returns: formatted string: rtype: str or unicode ""  

    However, I'm not sure how official / supported this format is.

Python DocString mainly has a 3/4 format competition. To see an overview, the old format, now closed, is the Epytext for Epydoc based on Javadoc style. Perhaps more popular is the redesigned text (REST) ​​ for the Sphinx format. The Google style is also quite used. And of course, Google style-inspired Numpydoc .

In what context can you mention in official / standard way.

Here are some examples of its criteria type and representation of return type in each format:

- Epytext / Javadoc

  "" @ Param 1: type the type of paragraph 1 type type param1: param1 type @ return: return value details @ type: return type type "" " 

- rest

  "": Param param1: Description of the parameter: type param1: type of param1: return: return value details: retype: the value of returned value "" " 

- Google

 " "" Argus: Ultimate 1: Description of Parameter `paragraph 1` param2 (str, optional ): Details of the parameter no. Returns: BULL: Correct or inaccurate on the basis of the result. "" " 

- Parameter ---------- param1: Description of int parameter` param1` param2: { Description of 'value1', 'value2'} parameter with two possible values. Return ------- int Returned Value "" "

Converting

< P> Note that if you do not have any docstring or you want to change your dosstring format for your Python project, you can use it.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -