[issue7447] Sum() doc and behavior mismatch

2010-05-18 Thread Leonhard Vogt

Leonhard Vogt  added the comment:

I changed the documentation regarding string not allowed as start argument and 
performance

I included the list concatenation with itertools.chain from
http://groups.google.com/group/comp.lang.python/msg/33e764d0ac41826a

patch is based on revision 81300 in py3k branch.

--
keywords: +patch
nosy: +lvogt
Added file: http://bugs.python.org/file17390/functions.rst.patch

___
Python tracker 
<http://bugs.python.org/issue7447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7447] Sum() doc and behavior mismatch

2010-07-26 Thread Leonhard Vogt

Leonhard Vogt  added the comment:

Thank you.

I think the specific list of list example is better for the sum documentation 
because lists support the + operator. I don't think
that someone would consider using sum for chaining arbitrary iterables.
What about a concise "To concatenate lists use itertools.chain.from_iterable." 
and letting the "apply list constructor" part as an exercise to the reader?

I did the explicit reference to itertools.itertools.chain.from_iterable since 
the default or the explicit link to itertools.chain.from_iterable did not 
produce a correct link in the html docs.
I applied patch3 and ran make html; there is no html link to from_iterable 
produced.

--

___
Python tracker 
<http://bugs.python.org/issue7447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7447] Sum() doc and behavior mismatch

2010-07-27 Thread Leonhard Vogt

Leonhard Vogt  added the comment:

another patch:
- moved string case to first position, i think it's the most important.
- reworded (shortened) list case.
- wrapped for <80 caracter lines.

still using itertools.itertools.chain.from_iterable as mentioned in previous 
message. I missed georgs use of ~ in the link, but i think its clearer to 
mention the full name of the function anyway.

--
Added file: http://bugs.python.org/file18223/functions.rst.patch4.txt

___
Python tracker 
<http://bugs.python.org/issue7447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Leonhard Vogt

Changes by Leonhard Vogt :


Removed file: http://bugs.python.org/file18223/functions.rst.patch4.txt

___
Python tracker 
<http://bugs.python.org/issue7447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Leonhard Vogt

Leonhard Vogt  added the comment:

Thank you Georg, I updated the patch

Ezio, wouldn't  start=0  in the signature  imply that sum accepted a keyword 
argument? I read "Documenting Python" (4.3) but am not sure about the 
distinction of default values or keyword arbuments.

>>> sum([1,2,3], start=4)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: sum() takes no keyword arguments

--
Added file: http://bugs.python.org/file18258/functions.rst.patch5.txt

___
Python tracker 
<http://bugs.python.org/issue7447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com