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.

classification
Title: csv.reader and .writer use wrong kwargs notation in 2.7 docs
Type: Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: cvrebert, docs@python, hynek, petri.lehtinen, python-dev
Priority: normal Keywords: easy, patch

Created on 2012-05-22 07:07 by hynek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue14880.patch cvrebert, 2012-08-27 05:50 fix all 3 instances of fmtparam review
Messages (8)
msg161332 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-05-22 07:07
It says

> csv.reader(csvfile[, dialect='excel'][, fmtparam])
> csv.writer(csvfile[, dialect='excel'][, fmtparam])

in 2.7. I presume it should be like in 3.x:

> csv.reader(csvfile, dialect='excel', **fmtparams)
> csv.writer(csvfile, dialect='excel', **fmtparams)

Or am I missing something?

(I found argument renaming to be too invasive for my default-args-notation ticket #14804)
msg161333 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-05-22 07:12
I verified from the source that it should be **fmtparams also in 2.7. Make sure you change the description texts, too, to s/fmtparam/fmtparams/.
msg169192 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-27 10:02
Chris: Thanks for the patch. I'm not sure register_dialect()'s signature is good like that, though. Hynek, what do you think?
msg169254 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-08-28 06:45
What does bother you? Both sigs look like in py3 if I'm looking correctly.
msg169261 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-28 09:40
Well, I wasn't sure about [optional] params before **kwargs. But if that's ok, then I think the patch is good.
msg169265 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-08-28 10:19
It seems correct like that:

static PyObject *
csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs)
{
    PyObject *name_obj, *dialect_obj = NULL;
    PyObject *dialect;

    if (!PyArg_UnpackTuple(args, "", 1, 2, &name_obj, &dialect_obj))
        return NULL;

Therefore going to commit.
msg169267 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-08-28 10:35
New changeset dc080e19f7aa by Hynek Schlawack in branch '2.7':
#14880: Fix kwargs notation in csv.reader, .writer & .register_dialect
http://hg.python.org/cpython/rev/dc080e19f7aa
msg169268 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-08-28 10:36
Thank you for your contribution Chris!
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 59085
2012-08-28 10:36:29hyneksetstatus: open -> closed
resolution: fixed
messages: + msg169268

stage: patch review -> resolved
2012-08-28 10:35:28python-devsetnosy: + python-dev
messages: + msg169267
2012-08-28 10:19:58hyneksetmessages: + msg169265
2012-08-28 09:40:28petri.lehtinensetmessages: + msg169261
2012-08-28 06:45:47hyneksetmessages: + msg169254
2012-08-27 10:02:51petri.lehtinensetmessages: + msg169192
stage: patch review
2012-08-27 05:50:14cvrebertsetfiles: + issue14880.patch
keywords: + patch
2012-05-22 21:00:22cvrebertsetnosy: + cvrebert
2012-05-22 07:12:21petri.lehtinensetnosy: + petri.lehtinen
messages: + msg161333
2012-05-22 07:07:35hynekcreate