This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marco.buttu
Recipients docs@python, marco.buttu
Date 2013-07-10.13:11:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373461894.57.0.746181395812.issue18424@psf.upfronthosting.co.za>
In-reply-to
Content
The documentaion of sum():

    Returns the sum of a sequence of numbers (NOT strings) plus the 
    value of parameter 'start' (which defaults to 0).  
    When the sequence is empty, returns start.

A. According to the PEP-8 it should be: "Return the sum...", and
   "When the sequence is empty, return start.", like the other docs. 
   For instance:

   >>> print(len.__doc__)
   len(object) -> integer

   Return the number of items of a sequence or mapping.

B. When the second argument is a tuple or a list, you can add sequences
   of sequences:

   >>> sum([['a', 'b', 'c'], [4]], [])
   ['a', 'b', 'c', 4]
   >>> sum(((1, 2, 3), (1,)), (1,))
   (1, 1, 2, 3, 1)

C. sum() takes not just sequences:

   >>> sum({1: 'one', 2: 'two'})
   3

Maybe it is not a good idea to give a complete description of sum() in the docstring, but perhaps something "good enough". In any case, I think the lack of the PEP-8 recommendation should be fixed.
History
Date User Action Args
2013-07-10 13:11:34marco.buttusetrecipients: + marco.buttu, docs@python
2013-07-10 13:11:34marco.buttusetmessageid: <1373461894.57.0.746181395812.issue18424@psf.upfronthosting.co.za>
2013-07-10 13:11:34marco.buttulinkissue18424 messages
2013-07-10 13:11:34marco.buttucreate