[issue14880] csv.reader and .writer use wrong kwargs notation in 2.7 docs

New submission from Hynek Schlawack <hs@ox.cx>: 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) ---------- assignee: docs@python components: Documentation keywords: easy messages: 161332 nosy: docs@python, hynek priority: normal severity: normal status: open title: csv.reader and .writer use wrong kwargs notation in 2.7 docs versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Petri Lehtinen <petri@digip.org> added the comment: 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/. ---------- nosy: +petri.lehtinen _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Changes by Chris Rebert <pybugs@rebertia.com>: ---------- nosy: +cvrebert _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Changes by Chris Rebert <pybugs@rebertia.com>: ---------- keywords: +patch Added file: http://bugs.python.org/file27008/issue14880.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Petri Lehtinen added the comment: Chris: Thanks for the patch. I'm not sure register_dialect()'s signature is good like that, though. Hynek, what do you think? ---------- stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Hynek Schlawack added the comment: What does bother you? Both sigs look like in py3 if I'm looking correctly. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Petri Lehtinen added the comment: Well, I wasn't sure about [optional] params before **kwargs. But if that's ok, then I think the patch is good. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Hynek Schlawack added the comment: 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. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Roundup Robot added the comment: 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 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________

Hynek Schlawack added the comment: Thank you for your contribution Chris! ---------- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14880> _______________________________________
participants (4)
-
Chris Rebert
-
Hynek Schlawack
-
Petri Lehtinen
-
Roundup Robot