Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ For example, to access the raw text from the AG_NEWS dataset:

>>> from torchtext.datasets import AG_NEWS
>>> train_iter = AG_NEWS(split='train')
>>> next(train_iter)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can still do next(iter(train)). Maybe we can change it to that instead?

Copy link
Contributor Author

@erip erip Jan 13, 2022

Choose a reason for hiding this comment

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

This is true, but calling iter(...) first will make an exhaustible iterator, right? This could introduce misleading usages which result in issues like #1447. I may be wrong, though. If I'm off-base, I can change the README as your recommend.

>>> # Or iterate with for loop
>>> # Iterate with for loop
>>> for (label, line) in train_iter:
>>> print(label, line)
>>> # Or send to DataLoader
Expand Down