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

bpo-12159: document sys.maxsize limit in len() function reference by Zac-HD · Pull Request #17934 · python/cpython · GitHub

Repository navigation

bpo-12159: document sys.maxsize limit in len() function reference - #17934

Merged
vstinner merged 1 commit into
python:masterfrom
Zac-HD:document-len-overflow
Jan 12, 2020
Merged

vstinner merged 1 commit into
python:masterfrom
Zac-HD:document-len-overflow

Conversation

Zac-HD commented Jan 10, 2020 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

See:

  • BPO-12159: "needs to be documented",
  • BPO-15718: added note to datamodel docs for __len__ method but not len(), and
  • BPO-21444: change request / wontfix

https://bugs.python.org/issue12159

cool-RR commented Jan 10, 2020

Copy link
Copy Markdown
Contributor

I think that this is a good addition to the documentation, but the example with range is weird. Maybe you mean that big ranges, such as range(10 ** 100) will be too big. That isn't clear from your text.

Comment thread Doc/library/functions.rst Outdated

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
Suggested change
on inputs larger than :data:`sys.maxsize`, such as :class:`range`.
on lengths larger than :data:`sys.maxsize`.

I don't understand the "such as range()" part. len(range(5)) returns 5, it doesn't fail with overflow?

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

I've clarified that this is for cases such as range(2 ** 64).

Comment thread Doc/library/functions.rst Outdated
vstinner changed the title BPO-12159: document sys.maxsize limit in function reference for len() bpo-12159: document sys.maxsize limit in len() function reference Jan 11, 2020

vstinner 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

LGTM, but I would prefer to get a second review. @csabella @serhiy-storchaka @JulienPalard: What do you think of this len note?

csabella left a comment

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

LGTM. Since this has been brought up multiple times, I think it's best to document it, especially since __len__ had a note added in the past. Thanks for the patch, @Zac-HD!

Comment thread Doc/library/functions.rst Outdated

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Zac-HD commented Jan 12, 2020

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

Copy link
Copy Markdown

Thanks for making the requested changes!

@csabella, @vstinner: please review the changes made to this pull request.

vstinner merged commit d7c7add into python:master Jan 12, 2020
Zac-HD deleted the document-len-overflow branch January 12, 2020 10:33
cool-RR mannequin mentioned this pull request Apr 29, 2022
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 skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL