[issue30538] Functional Programming HOWTO describes one argument itertools.count()
New submission from Cheryl Sabella:
The Functional Programming HOWTO describes single variable itertools.count instead of the two variable version that is linked to.
----------
assignee: docs@python
components: Documentation
messages: 294935
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Functional Programming HOWTO describes one argument itertools.count()
versions: Python 3.7
_______________________________________
Python tracker
Changes by Cheryl Sabella
Raymond Hettinger added the comment:
If you would like, go ahead an submit a PR.
----------
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low
_______________________________________
Python tracker
Changes by Cheryl Sabella
Cheryl Sabella added the comment:
Submitted a PR, thank you.
I changed added the argument for count(). Also I noticed that the link to accumulate() was broken, so I fixed that and I added a link to functools in the references at the end of the page.
One other thing I noticed was that enumerate was described with one argument, but it takes two. Should I update that as well?
Thanks!
----------
_______________________________________
Python tracker
Raymond Hettinger added the comment:
enumerate was described with one argument, but it takes two. Should I update that as well?
Yes please.
----------
_______________________________________
Python tracker
Cheryl Sabella added the comment:
Thank you. I've added that.
This may seem like an odd question, but should I assume that the docs should always match the code? For example, in the Functional HOWTO, I wasn't sure if the arguments were left off purposely or if it was just something that hadn't been updated. If the docs should always match, then I wouldn't have to ask so many questions if I see another place where this happens.
Also, the example for enumerate is this:
f = open('data.txt', 'r')
for i, line in enumerate(f):
if line.strip() == '':
print('Blank line at line #%i' % i)
Is it code churn to replace the old style string formatting or is that something else that should be done as clean-up?
----------
_______________________________________
Python tracker
Raymond Hettinger added the comment:
Is it code churn to replace the old style string formatting or is that something else that should be done as clean-up?
Let's leave it as is. Old-style formatting is still valid and is not going away. We consciously decided not to sweep through the docs change the string formatting style. Also, since both occur quite a bit in the wild, it is is useful for the docs to show some of both.
----------
_______________________________________
Python tracker
Raymond Hettinger added the comment:
New changeset 9be4ff359daa67cde6246494f643ed7cd2825d46 by Raymond Hettinger (csabella) in branch 'master':
bpo-30538: Update count() in Functional Programming HOWTO (#1919)
https://github.com/python/cpython/commit/9be4ff359daa67cde6246494f643ed7cd28...
----------
_______________________________________
Python tracker
Raymond Hettinger added the comment:
Thank you for the PR.
----------
resolution: -> fixed
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker
Cheryl Sabella added the comment:
Thank you. And thank you for explaining about the strings. That's what I suspected, so I appreciate you confirming it.
----------
_______________________________________
Python tracker
Changes by Cheryl Sabella
Changes by Cheryl Sabella
Mariatta Wijaya added the comment:
New changeset b32fb6c1fb6cdf019817176f573e60c0923a6e22 by Mariatta (csabella) in branch '3.5':
bpo-30538: Update count() in Functional Programming HOWTO (GH-1919) (GH-1944)
https://github.com/python/cpython/commit/b32fb6c1fb6cdf019817176f573e60c0923...
----------
nosy: +Mariatta
_______________________________________
Python tracker
Mariatta Wijaya added the comment:
New changeset ce40550acd3a8928bb6fef4d4e73642a8a69745d by Mariatta (csabella) in branch '3.6':
bpo-30538: Update count() in Functional Programming HOWTO (GH-1919) (GH-1943)
https://github.com/python/cpython/commit/ce40550acd3a8928bb6fef4d4e73642a8a6...
----------
_______________________________________
Python tracker
participants (3)
-
Cheryl Sabella
-
Mariatta Wijaya
-
Raymond Hettinger