[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-09 Thread STINNER Victor
STINNER Victor added the comment: I merged PR 12306. Thanks Ashish Nitin Patil for the initial patch, thanks Rémi Lapeyre to converting it to a PR, thanks Logan for the initial bug report ;-) Sadly, this change is a new feature and so cannot be backported to 2.7 or 3.7. The workaround is

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-09 Thread STINNER Victor
STINNER Victor added the comment: New changeset fce5ff1e18b522cf52379934a6560583d840e7f9 by Victor Stinner (Rémi Lapeyre) in branch 'master': bpo-27497: Add return value to csv.DictWriter.writeheader (GH-12306) https://github.com/python/cpython/commit/fce5ff1e18b522cf52379934a6560583d840e7f9

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-07 Thread Skip Montanaro
Skip Montanaro added the comment: I think this is ready to go. I added a comment to PR12306. As I am no longer a committer, I'm not sure what the next step is. -- ___ Python tracker

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-06 Thread MICHAEL BLAHAY
MICHAEL BLAHAY added the comment: Ah ha, so there is. I'm glad this one will get closed out. Sorry for noob mistake. -- ___ Python tracker ___

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-06 Thread SilentGhost
SilentGhost added the comment: Michael, there is a up-to-date PR that's waiting for approval. -- nosy: +SilentGhost ___ Python tracker ___

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-05-06 Thread MICHAEL BLAHAY
MICHAEL BLAHAY added the comment: I would like to drive this to conclusion since it appears this issue has not had any real activity in a while. First thing that needs to be determined is whether this enhancement is still desirable. Who can answer this? -- nosy: +MICHAEL BLAHAY

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-03-13 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- versions: +Python 3.8 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27497] csv module: Add return value to DictWriter.writeheader

2019-03-13 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- pull_requests: +12282 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-05 Thread Ashish Nitin Patil
Ashish Nitin Patil added the comment: Thank you Berker & Skip for your review & additional inputs. I have added a (probably not so good) unittest for testing the newly added *return*. I have also added the corresponding *versionchanged* info to the documentation as suggested by Berker. Will

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-05 Thread Skip Montanaro
Skip Montanaro added the comment: Also, a change in behavior has to be very carefully considered, even though it passes all existing test cases (and presumably the one(s) you'll add). The change may well only be acceptable for the next minor release of 3.x. On Mon, Sep 5, 2016 at 7:31 AM,

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-05 Thread Berker Peksag
Berker Peksag added the comment: Thanks! The patch lacks a test case (you can add it into Lib/test/test_csv.py) and a versionchanged notice in documentation (see http://cpython-devguide.readthedocs.io/en/latest/documenting.html#paragraph-level-markup for details.) -- stage: needs

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-04 Thread Ashish Nitin Patil
Ashish Nitin Patil added the comment: Also, I noticed in the documentation for `csv.DictWriter` (https://docs.python.org/3/library/csv.html#csv.DictWriter.writeheader) does not contain the following line - to the writer's file object, formatted according to the current dialect. Although

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-04 Thread Ashish Nitin Patil
Ashish Nitin Patil added the comment: Hi, I have added the "return" to the writeheader method. I ran the tests for the csv library (./python -m test -v test_csv) and got no errors (Ran 101 tests in 0.322s; 1 test OK.). Kindly review the patch. -- keywords: +patch nosy:

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-14 Thread STINNER Victor
STINNER Victor added the comment: I'm now ok to add the return, but only in Python 3.6. It would be a minor new "feature". -- ___ Python tracker ___

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-14 Thread Logan
Logan added the comment: @berker.peksag: Good catch, thank you. In my code base I'm using a slightly different implementation which does use an iterator, so I didn't even catch that the default django example was incorrect. @skip.montanaro: That is exactly the one-liner I'm currently using.

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-14 Thread Skip Montanaro
Skip Montanaro added the comment: I agree writeheader() should have returned the value of writerow(), but have no opinion on the more esoteric stuff you're discussing. I think you could argue that adding the "return" would be a bug fix. Personally, I long ago got in the habit of using the

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-13 Thread Berker Peksag
Berker Peksag added the comment: By the way, there is an open ticket about changing the recipe in Django documentation: https://code.djangoproject.com/ticket/26040 -- nosy: +berker.peksag ___ Python tracker

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-13 Thread STINNER Victor
STINNER Victor added the comment: Oh. I missed the django recipe to implement "streaming csv". It uses an Echo object, its write() method returns its parameter. This recipe looks like an abuse of the API, but I understand that there is a need for a kind of "partial write": give control to I/O

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-13 Thread R. David Murray
R. David Murray added the comment: It doesn't make sense when the return value is that provided by io.write. It does make sense in the context of the linked example (a psuedo-file object). However, it *is* an undocumented API, even if people are using it. --

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: It is a bit irritating to have this small API inconsistency, but I'm a little wary of propagating this undocumented and untested behavior especially given Victor's concern about whether it makes any sense in this context. Skip, what do you think?

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread R. David Murray
R. David Murray added the comment: It isn't documented that writer.writeline returns anything, but what it actually returns is whatever the write method of the underlying file object returns. Obviously (given the linked example), this fact is being used. There is value in consistency, so I

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread STINNER Victor
STINNER Victor added the comment: It doesn't seem right to me. The writer should be blocking: write *all* data, don't use partial write. Supporting partial write (non-blocking files) requires more changes, and it isn't worth it. Here the problem is that the function doesn't support partial

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread Zachary Ware
Zachary Ware added the comment: This seems like a reasonable request, but could only be done in 3.6 as it would be a new feature. -- keywords: +easy nosy: +zach.ware stage: -> needs patch versions: -Python 3.5 ___ Python tracker

[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread Logan
New submission from Logan: Currently, DictWriter.writeheader() is defined like: def writeheader(self): header = dict(zip(self.fieldnames, self.fieldnames)) self.writerow(header) It would be useful to have it return the value of writerow(): def writeheader(self):