Giter Site home page Giter Site logo

robruana / numpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from numpy/numpy

0.0 0.0 0.0 25.49 MB

Numpy main repository

Home Page: http://www.numpy.org/

License: BSD 3-Clause "New" or "Revised" License

Python 39.91% C 57.80% Perl 0.01% Fortran 0.10% C++ 2.17% Shell 0.03%

numpy's People

Contributors

87 avatar certik avatar cfarrow avatar cgohlke avatar chanley avatar charris avatar cournape avatar dwf avatar endolith avatar eric-jones avatar jarrodmillman avatar jayvius avatar jsalvatier avatar juliantaylor avatar m-d-w avatar matthew-brett avatar mwiebe avatar njsmith avatar nouiz avatar pearu avatar pv avatar rc avatar rgommers avatar rkern avatar seberg avatar stefanv avatar teoliphant avatar thouis avatar timleslie avatar warrenweckesser avatar

Watchers

 avatar  avatar

numpy's Issues

Enhancement to "Returns" section for numpy doc strings

Abstract

The current numpy documentation spec says that the Returns section uses the same format as the Parameters section, which requires a name for each parameter. Named return values are not a part of the python language, yet the Returns section requires a name for each return value. Requiring developers to document names for return values โ€“ especially when a function returns only one value โ€“ opens the door to arbitrary and potentially misleading names.

Proposed Enhancement

Developers usually only need the type of a return value followed by a brief description. However, in some cases providing a name for a return value can make the documentation clearer. This proposal would change the format of the Returns section such that the type is required, and the name is optional:

Returns
-------
int
    Description of anonymous integer return value.
x : str
    Description of string return value named `x`.

With the proposed change, if a colon is not present, then the entire line is interpreted as the return type. In all other cases, the Returns section is interpreted according to the current rules.

Consistent with the current format, if a colon is present, then the text to the left of the colon is interpreted as the name; and the text to the right of the colon is interpreted as the type. This makes the proposed change backwards compatible with existing documentation.

Examples

A simple string method from the stdlib that returns a boolean:

.. method:: str.isalpha()

   Determines if all characters in the string are alphabetic.

   For 8-bit strings, this method is locale-dependent.

   Returns
   -------
   bool
      True if all characters in the string are alphabetic 
      and there is at least one character, False otherwise.

A string method from the std lib that returns three values:

.. method:: str.partition(sep)

   Split the string at the first occurrence of `sep`.

   Parameters
   ----------
   sep : str
       Substring of one or more characters to find in the string.

   Returns
   -------
   before_sep : str
      The part of the string before `sep`, or the entire string if `sep` is not found.
   found_sep : str
      The separator itself, or an empty string if `sep` is not found.
   after_sep : str
      The part of the string after `sep`, or an empty string if `sep` is not found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.