FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-21056: Document return type of next method of csv reader by aktech · Pull Request #146 · python/cpython · GitHub

Repository navigation

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

Merged
Mariatta merged 3 commits into
python:masterfrom
aktech:csv_reader_next_doc
May 23, 2017
Merged

Mariatta merged 3 commits into
python:masterfrom
aktech:csv_reader_next_doc

Conversation

aktech commented Feb 18, 2017 •
edited
Loading

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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!

Comment thread Doc/library/csv.rst Outdated
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)``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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) [...]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sounds good! Fixed.

JDLH commented Feb 20, 2017

Copy link
Copy Markdown
Contributor

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 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 commented Feb 20, 2017

Copy link
Copy Markdown
Contributor Author

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.

Comment thread Doc/library/csv.rst Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread Doc/library/csv.rst Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if it is a :class:`DictReader` instance

Comment thread Doc/library/csv.rst Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Add two spaces after a full-stop:

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

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 commented Feb 21, 2017

Copy link
Copy Markdown
Contributor Author

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

berkerpeksag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Member

Thanks @aktech

Copy link
Copy Markdown
Contributor

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

akruis pushed a commit to akruis/cpython that referenced this pull request Dec 20, 2017
This fix prevent a NULL-pointer access (SEGFAULT), if a thread
terminates with a MemoryError exception.
akruis pushed a commit to akruis/cpython that referenced this pull request Mar 25, 2018
This fix prevent a NULL-pointer access (SEGFAULT), if a thread
terminates with a MemoryError exception.
(cherry picked from commit bcd724c)
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Merge the PR if:
- PR has "awaiting merge" and "automerge" labels, and
- all CI status checks have passed.

It will:
- replace `#` with `GH-`
- get the commit message from PR title and description

Closes python/bedevere#14
Closes python/core-workflow#29
lazka added a commit to lazka/cpython that referenced this pull request Jan 17, 2026
This makes sure that the ctypes module is built.
See python#146
lazka added a commit to lazka/cpython that referenced this pull request Jan 24, 2026
This makes sure that the ctypes module is built.
See python#146
lazka added a commit to lazka/cpython that referenced this pull request Jan 24, 2026
This makes sure that the ctypes module is built.
See python#146
lazka added a commit to lazka/cpython that referenced this pull request Jan 24, 2026
This makes sure that the ctypes module is built.
See python#146
lazka added a commit to lazka/cpython that referenced this pull request Jan 24, 2026
This makes sure that the ctypes module is built.
See python#146
lazka added a commit to lazka/cpython that referenced this pull request Jan 24, 2026
This makes sure that the ctypes module is built.
See python#146
pablogsal pushed a commit that referenced this pull request Jun 27, 2026
#148351)

[3.11] gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212)
(cherry picked from commit 05ed7ce)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
pablogsal pushed a commit that referenced this pull request Jun 27, 2026
#148350)

[3.10] gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212)
(cherry picked from commit 05ed7ce)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL