-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-138178: Doc: Clarify that range is an immutable sequence #138184
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
Closed
+1
−1
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
65451a6
Clarify host and port parameter behavior in smtplib.SMTP_SSL initiali…
Aniketsy 7337b6d
Clarify host and port parameter behavior in smtplib.SMTP_SSL initiali…
Aniketsy 54907a0
Clarify smtplib docs: host/port explanation
Aniketsy 058ab0a
Doc: Add iterator reference and anchor to range() documentation
Aniketsy a1e470b
Doc: Add iterator reference and anchor to range() documentation
Aniketsy 3f553c0
Doc: Add iterator reference and anchor to range() documentation
Aniketsy 771dafc
Doc: Add iterator reference and anchor to range() documentation
Aniketsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1736,7 +1736,9 @@ are always available. They are listed here in alphabetical order. | |
Rather than being a function, :class:`range` is actually an immutable | ||
sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`. | ||
|
||
|
||
The object returned by :class:`range` is an :term:`iterator` and supports iteration. | ||
See also :ref:`iterator` for more information about iterators and how to implement | ||
custom iterable classes. | ||
|
||
.. function:: repr(object) | ||
|
||
Return a string containing a printable representation of an object. For many | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not totally correct to say "the object returned by
range
", becauserange
itself is the object. Instead, we should say something like "therange
type is aniterator
".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback and corrections!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or along the lines of "an instance of
range
is an iterator"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn’t correct -
range
isn’t an iterator, it’s a sequence (though it is iterable). Note how you can iterate the same range object multiple times, andnext()
fails. There’s a separaterange_iterator
type, likelist_iterator
etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah. Let's just say "
range
supports iteration" or something like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have update with this
The :class:
rangetype is iterable and supports iteration.
Please let me know , if this needs further improvement .