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.
Created on 2018年02月07日 01:51 by cowlinator, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 5575 | merged | matrixise, 2018年02月07日 06:27 | |
| Messages (12) | |||
|---|---|---|---|
| msg311759 - (view) | Author: cowlinator (cowlinator) | Date: 2018年02月07日 01:51 | |
The documentation for the csv.DictReader constructor (and presumably csv.DictWriter also) has the wrong name written for the first argument. This prevents the argument from being called by name.
>>> file = open("file.txt", 'a')
>>> csv.DictReader(csvfile=file)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() takes at least 2 arguments (1 given)
>>> csv.DictReader(f=file)
<csv.DictReader instance at 0x04D97A08>
>>> # how could i have known it was named 'f'?
Please change the documentation.
|
|||
| msg311761 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2018年02月07日 02:49 | |
In the python3 docs it is given as 'f'. In the python2 docs, it is not. I suppose a doc backport was missed. |
|||
| msg311763 - (view) | Author: Josh Rosenberg (josh.r) * (Python triager) | Date: 2018年02月07日 04:10 | |
Side-note: You say "how could i have known it was named 'f'?" >>> help(csv.DictReader) class DictReader | Methods defined here: | | __init__(self, f, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds) ... rest of class help ... Not saying the docs shouldn't be fixed, but the name is correctly given in the __init__ prototype (being implemented in Python, the names are always available to help() introspection, barring really specific cases of manual parsing of **kwargs). Just a general tip for the future. |
|||
| msg311765 - (view) | Author: Stéphane Wirtel (matrixise) * (Python committer) | Date: 2018年02月07日 06:33 | |
I just fixed the documentation, but I think we should change the name of the first parameter in master for 3.8. Maybe for 3.7, because we have to fix the docs. @david, what is your opinion? I am going to propose a PR for the naming of the first argument |
|||
| msg311768 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年02月07日 07:04 | |
See issue16026 for the fix in 3.x. |
|||
| msg311769 - (view) | Author: Stéphane Wirtel (matrixise) * (Python committer) | Date: 2018年02月07日 07:34 | |
Hi @Serhiy I try to use the cherry-picking method for the patch from 3.6 but without success, I preferred to reuse my initial commit and remove the News.d entry. |
|||
| msg311787 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2018年02月07日 12:06 | |
Stéphane: I don't understand your question about changing the name of the parameter. As far as I can see the only thing to do here is backport the doc fix to 2.7. |
|||
| msg311788 - (view) | Author: Stéphane Wirtel (matrixise) * (Python committer) | Date: 2018年02月07日 12:26 | |
Hi David, At the final, I didn't propose my PR with the renaming. because PyPy and CPython use f as the first parameter of these classes. If @Serhiy does the review of my PR, we can close this issue. |
|||
| msg311794 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2018年02月07日 16:05 | |
New changeset 672fd7d8162f76aff8423fa5c7bfd2b1e91faf57 by Mariatta (Stéphane Wirtel) in branch '2.7': bpo-32784: Wrong argument name for csv.DictReader in documentation (GH-5575) https://github.com/python/cpython/commit/672fd7d8162f76aff8423fa5c7bfd2b1e91faf57 |
|||
| msg311795 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2018年02月07日 16:07 | |
Thanks everyone! |
|||
| msg311859 - (view) | Author: cowlinator (cowlinator) | Date: 2018年02月09日 01:28 | |
Hi, thanks for the quick action on this! The documentation is still wrong for 3.5 . I had selected 3.5 for the affected versions, but I guess it got removed? |
|||
| msg311860 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2018年02月09日 01:32 | |
3.5 is for security fixes only now. We don't do documentation or regular bug fixes there anymore. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:57 | admin | set | github: 76965 |
| 2018年02月09日 01:32:40 | Mariatta | set | messages:
+ msg311860 versions: - Python 3.5 |
| 2018年02月09日 01:28:41 | cowlinator | set | messages:
+ msg311859 versions: + Python 3.5 |
| 2018年02月07日 16:07:00 | Mariatta | set | status: open -> closed resolution: fixed messages: + msg311795 stage: patch review -> resolved |
| 2018年02月07日 16:05:42 | Mariatta | set | nosy:
+ Mariatta messages: + msg311794 |
| 2018年02月07日 12:26:34 | matrixise | set | messages: + msg311788 |
| 2018年02月07日 12:06:56 | r.david.murray | set | messages: + msg311787 |
| 2018年02月07日 07:34:07 | matrixise | set | messages: + msg311769 |
| 2018年02月07日 07:04:29 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg311768 |
| 2018年02月07日 06:33:04 | matrixise | set | keywords:
+ needs review, - patch nosy: + matrixise messages: + msg311765 |
| 2018年02月07日 06:27:44 | matrixise | set | keywords:
+ patch stage: patch review pull_requests: + pull_request5393 |
| 2018年02月07日 04:10:34 | josh.r | set | nosy:
+ josh.r messages: + msg311763 |
| 2018年02月07日 02:49:05 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg311761 versions: - Python 3.5 |
| 2018年02月07日 01:51:05 | cowlinator | create | |