Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-21056: Document return type of next method of csv reader #146

Merged
merged 3 commits into from May 23, 2017

Conversation

Projects
None yet
9 participants
@aktech
Copy link
Contributor

commented Feb 18, 2017

csv.reader

>>> import csv
>>> fp = open('foo.csv')
>>> csv_reader = csv.reader(fp)
>>> next(csv_reader)
['a', 'b', 'c', 'd']

csv.DictReader

>>> fp = open('foo.csv')
>>> csv_dict_reader = csv.DictReader(fp)
>>> next(csv_dict_reader)
OrderedDict([('a', 'e'), ('b', 'f'), ('c', 'g'), ('d', 'h')])

Contents of foo.csv

a,b,c,d
e,f,g,h
i,j,k,l

Documentation: https://docs.python.org/3.7/library/csv.html#reader-objects

@the-knights-who-say-ni

This comment has been minimized.

Copy link

commented Feb 18, 2017

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow these steps to rectify the issue:

  1. Sign the PSF contributor agreement
  2. Wait at least one US business day and then check "Your Details" on bugs.python.org to see if your account has been marked as having signed the CLA (the delay is due to a person having to manually check your signed CLA)
  3. Reply here saying you have completed the above steps

Thanks again to your contribution and we look forward to looking at it!

to the current dialect. Usually you should call this as ``next(reader)``.
Return the next row of the reader's iterable object as a list (if reader) or
dict (if DictReader), parsed according to the current dialect. Usually you
should call this as ``next(reader)``.

This comment has been minimized.

Copy link
@DimitrisJim

DimitrisJim Feb 18, 2017

Contributor

I think it would be better to change these to:

Return the next row of the reader's iterable object as a list (if the object was returned from reader()) or a dict (if it is a DictReader) [...]

This comment has been minimized.

Copy link
@aktech

aktech Feb 18, 2017

Author Contributor

Sounds good! Fixed.

@JDLH

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2017

Could you please check the bpo number? bpo-29521 has to do with Sphinx and building documentation, and has nothing to do with CSV support. As far as I know.

@aktech aktech changed the title bpo-29521 document return type of next method of csv reader bpo-21056 document return type of next method of csv reader Feb 20, 2017

@aktech

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2017

Could you please check the bpo number? bpo-29521 has to do with Sphinx and building documentation, and has nothing to do with CSV support. As far as I know.

Yeah, Thanks! I have fixed it now.

Return the next row of the reader's iterable object as a list, parsed according
to the current dialect. Usually you should call this as ``next(reader)``.
Return the next row of the reader's iterable object as a list (if the object
was returned from ``reader()``) or a dict (if it is a ``DictReader``), parsed

This comment has been minimized.

Copy link
@berkerpeksag

berkerpeksag Feb 21, 2017

Member

reader() is not very clear here. "[...] from :func:`reader`" would be much clearer.

Return the next row of the reader's iterable object as a list, parsed according
to the current dialect. Usually you should call this as ``next(reader)``.
Return the next row of the reader's iterable object as a list (if the object
was returned from ``reader()``) or a dict (if it is a ``DictReader``), parsed

This comment has been minimized.

Copy link
@berkerpeksag

berkerpeksag Feb 21, 2017

Member

if it is a :class:`DictReader` instance

to the current dialect. Usually you should call this as ``next(reader)``.
Return the next row of the reader's iterable object as a list (if the object
was returned from ``reader()``) or a dict (if it is a ``DictReader``), parsed
according to the current dialect. Usually you should call this as

This comment has been minimized.

Copy link
@berkerpeksag

berkerpeksag Feb 21, 2017

Member

Add two spaces after a full-stop:

[...] dialect.  Usually [...]

@berkerpeksag berkerpeksag changed the title bpo-21056 document return type of next method of csv reader bpo-21056: Document return type of next method of csv reader Feb 21, 2017

@aktech

This comment has been minimized.

Copy link
Contributor Author

commented Feb 21, 2017

@berkerpeksag Thanks for the Review, I have made the changes now. Please have a look.

@berkerpeksag
Copy link
Member

left a comment

Looking at this again, I agree with Josh Rosenberg's comment at https://bugs.python.org/issue21056#msg214856 It would be better to the documentation for __next__ and document the return types of them in their documentation. Plus, we can adapt the examples you gave in #146 (comment) to the existing ones.

@rhettinger

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2017

This looks fine. I'm not sure it is necessary though (I don't recall it ever having been a source of confusion).

@Mariatta Mariatta merged commit d618c8c into python:master May 23, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Mariatta

This comment has been minimized.

Copy link
Member

commented May 23, 2017

Thanks @aktech

Mariatta added a commit to Mariatta/cpython that referenced this pull request May 23, 2017

Mariatta added a commit to Mariatta/cpython that referenced this pull request May 23, 2017

ambv added a commit that referenced this pull request May 23, 2017

ambv added a commit that referenced this pull request May 23, 2017

@ncoghlan ncoghlan added the sprint label May 28, 2017

@ncoghlan

This comment has been minimized.

Copy link
Contributor

commented May 28, 2017

Added the sprint label, as this PR was submitted at the PyCon Pune 2017 core development sprint.

mlouielu added a commit to mlouielu/cpython that referenced this pull request Jun 15, 2017

akruis added a commit to akruis/cpython that referenced this pull request Dec 20, 2017

Stackless issue python#146: always initialize the bomb type
This fix prevent a NULL-pointer access (SEGFAULT), if a thread
terminates with a MemoryError exception.

akruis added a commit to akruis/cpython that referenced this pull request Mar 25, 2018

Stackless issue python#146: always initialize the bomb type
This fix prevent a NULL-pointer access (SEGFAULT), if a thread
terminates with a MemoryError exception.
(cherry picked from commit bcd724c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.