Skip to content

Fix example code for islice#148966

Closed
ellishg wants to merge 1 commit intopython:mainfrom
ellishg:fix-islice-docs
Closed

Fix example code for islice#148966
ellishg wants to merge 1 commit intopython:mainfrom
ellishg:fix-islice-docs

Conversation

@ellishg
Copy link
Copy Markdown

@ellishg ellishg commented Apr 24, 2026

As far as I can tell, islice('ABCDEFG', 2) should result in C D E F G, which is the same as a later example. I suspect the original author meant to use islice('ABCDEFG', 0, 2).


📚 Documentation preview 📚: https://cpython-previews--148966.org.readthedocs.build/

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 24, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Apr 24, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Apr 24, 2026
@ellishg
Copy link
Copy Markdown
Author

ellishg commented Apr 24, 2026

Actually I've realized the code in the docs are correct, but I do think the wording could be improved. I'll open a github issue instead.

@ellishg ellishg closed this Apr 24, 2026
@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 25, 2026

I don't think we need to do anything here actually. The arguments' meaning are similar to range() so it's not necessary to change the wording IMO.

@ellishg
Copy link
Copy Markdown
Author

ellishg commented Apr 25, 2026

I realized that if there is one argument then it is stop, not start, which explains my confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants