[issue7447] Sum() doc and behavior mismatch

2010-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: Fixed in r86066, r86068 and r86069. -- resolution: -> fixed status: open -> closed versions: -Python 2.6 ___ Python tracker ___ ___

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: Please do. This issue comes up often enough on python-list. Make it a separate doc issue, which will be auto-assigned to d...@python and add me as nosy. -- ___ Python tracker

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Łukasz Langa
Łukasz Langa added the comment: > For Python functions, all arguments can be keyword arguments. For many > builtins, none can be (and maybe there should be a note to that effect at the > top of the built-in functions chapter). +1 Many Python users don't really grasp how builtins are differen

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: For Python functions, all arguments can be keyword arguments. For many builtins, none can be (and maybe there should be a note to that effect at the top of the built-in functions chapter). 'Param = default' merely means that the parameter has a default argume

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Łukasz Langa
Łukasz Langa added the comment: The oldest interfaces tend to have quirks like that. Similar issue: #9379. Won't be changed as well. I'm thinking of a better docstring though. -- nosy: +lukasz.langa ___ Python tracker

[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=

[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 ___ ___ Python-bugs-list

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Georg Brandl
Georg Brandl added the comment: from_iterable() was marked up wrongly in the itertools docs; this is fixed now in r83230. -- ___ Python tracker ___ _

[issue7447] Sum() doc and behavior mismatch

2010-07-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: I am puzzled that the fake name 'itertools.itertools.chain.from_iterable' works better than the real name 'itertools.chain.from_iterable'. Some bug in the tool chain? -- ___ Python tracker

[issue7447] Sum() doc and behavior mismatch

2010-07-27 Thread Ezio Melotti
Ezio Melotti added the comment: You could also use start=0 in the signature. -- ___ Python tracker ___ ___ Python-bugs-list mailing li

[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

[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 i

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: I want to look at this more before it goes forward. The docs are roughly correct as-is. In a effort to make them precise, it is easy make them more confusing or at least a bit harder to understand the basic function of sum(). -- assignee: d...@pytho

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: patch3 incorporates all your suggestions. I verified the itertools hint: >>> list(itertools.chain.from_iterable([[10],[1,2],['a']])) [10, 1, 2, 'a'] I think the hints are clear enough; anyone with more questions should follow the link to the respective functi

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: FWIW, I like the new patch better, but still have a few nitpicks: - Starting a sentence with an argument name is a bit awkward because that makes a sentence that starts with a lower case letter. - There is an extra space in :class: `list`. - It would

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: In order to have a chance at 2.6.6rc, due out in a week, I hand-edited the patch, incorporating Georg's suggestion, and uploaded. I think it is ready to commit. Since this is not a critical doc fix, I am not marking it a blocker, but I still think it would b

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Georg Brandl
Georg Brandl added the comment: Note that using `~itertools.chain.from_iterable` is equivalent to `from_iterable ` and saves a repetition. -- ___ Python tracker ___

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: Leonard, that you for the patch, in particular, the list of hints. I think the first is good but overly specific. It also has an extra '.itertools' in the path. Now: ''' + - To concatenate a list of lists ``lol`` use ``list(itertools.chain.from_iterable

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: A nitpick: "lol" is a very well-known acronym and "list of lists" is not the expansion that first comes to mind. -- nosy: +belopolsky ___ Python tracker ___

[issue7447] Sum() doc and behavior mismatch

2010-07-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[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

[issue7447] Sum() doc and behavior mismatch

2009-12-07 Thread Ezio Melotti
Ezio Melotti added the comment: There are also a couple more things that could be improved in the documentation of sum(): 1) add a note about the "performance trap" mentioned by Alex [1] 2) remove the reduce() example because, even if it's true for that particular example, it's not always true f

[issue7447] Sum() doc and behavior mismatch

2009-12-06 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: georg.brandl -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list ma

[issue7447] Sum() doc and behavior mismatch

2009-12-05 Thread Terry J. Reedy
New submission from Terry J. Reedy : "sum(iterable[, start]) Sums start and the items of an iterable from left to right and returns the total. start defaults to 0. The iterable‘s items are normally numbers, and are not allowed to be strings." The last sentence is not currently true (3.1, assume