On Sep 19, 11:34 am, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Sep 19, 2012 at 9:37 AM, Steve Howell <showel...@yahoo.com> wrote: > > Sequences are iterables, so I'd say the docs are technically correct, > > but maybe I'm misunderstanding what you would be trying to clarify. > > The doc string suggests that the argument to sum() must be a sequence, > when in fact any iterable will do. The restriction in the docs should > be relaxed to match the reality.
Ah. The docstring looks to be fixed in 3.1.3, but not in Python 2. Python 3.1.3 (r313:86834, Mar 13 2011, 00:40:38) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> sum.__doc__ "sum(iterable[, start]) -> value\n\nReturns the sum of an iterable of numbers (NOT strings) plus the value\nof parameter 'start' (which defaults to 0). When the iterable is\nempty, returns start." Python 2.6.6 (r266:84292, Mar 13 2011, 00:35:19) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> sum.__doc__ "sum(sequence[, start]) -> value\n\nReturns the sum of a sequence of numbers (NOT strings) plus the value\nof parameter 'start' (which defaults to 0). When the sequence is\nempty, returns start." >>> -- http://mail.python.org/mailman/listinfo/python-list