GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Formatting fixes in contextlib page by slateny · Pull Request #98111 · python/cpython

Conversation

@slateny

@slateny slateny commented Oct 9, 2022

Copy link
Copy Markdown
Contributor

Removed and added some >>>/... depending on whether it had sample outputs. removed unneeded whitespace, added whitespace to make example 4-space indentation

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slateny
Fix some formatting in contextlib page
7dcc7d0
@slateny
slateny requested a review from 1st1 as a code owner October 9, 2022 01:32
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 9, 2022
@slateny slateny added the skip issue label Oct 9, 2022
@slateny slateny mentioned this pull request Oct 9, 2022
Fix indentation in contextlib documentation to three spaces #94361
Closed
JelleZijlstra
JelleZijlstra reviewed Oct 10, 2022
View reviewed changes
Comment thread Doc/library/contextlib.rst Outdated
>>> from asyncio import run
>>> from contextlib import AsyncContextDecorator

>>> class mycontext(AsyncContextDecorator):

@JelleZijlstra JelleZijlstra Oct 10, 2022

Copy link
Copy Markdown
Member

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'm a little sad that this makes the code harder to copy-paste, but agree that this improves consistency. I guess the idea in the existing code was to have no >>> for the code defining the sample classes, only for the code using them. I am going to look at the rest of the docs to see whether that's an established convention.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@slateny slateny Oct 10, 2022

Copy link
Copy Markdown
Contributor Author

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.

If that was the idea, then I think the code block can just be split into two with something like 'managed_resource can then be used like the following:', and have the second chunk contain the >>>

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@slateny slateny Oct 12, 2022

Copy link
Copy Markdown
Contributor Author

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.e.:
image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JelleZijlstra JelleZijlstra Oct 12, 2022

Copy link
Copy Markdown
Member

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 think that would be better, thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slateny
Separate code definition and code execution
e66f8e9
JelleZijlstra
JelleZijlstra approved these changes Oct 12, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Oct 12, 2022
@JelleZijlstra JelleZijlstra self-assigned this Oct 12, 2022
@JelleZijlstra JelleZijlstra added needs backport to 3.10 needs backport to 3.11 only security fixes labels Oct 12, 2022
@JelleZijlstra
JelleZijlstra merged commit 3b33c20 into python:main Oct 12, 2022
@miss-islington

miss-islington commented Oct 12, 2022

Copy link
Copy Markdown
Contributor

Thanks @slateny for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Oct 12, 2022
@bedevere-bot

bedevere-bot commented Oct 12, 2022

Copy link
Copy Markdown

GH-98205 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 12, 2022
@bedevere-bot

bedevere-bot commented Oct 12, 2022

Copy link
Copy Markdown

GH-98206 is a backport of this pull request to the 3.10 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 label Oct 12, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 12, 2022
@slateny @miss-islington
Formatting fixes in contextlib docs (pythonGH-98111)
36ebea3
(cherry picked from commit 3b33c20)

Co-authored-by: Stanley <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 12, 2022
@slateny @miss-islington
Formatting fixes in contextlib docs (pythonGH-98111)
f7f6c42
(cherry picked from commit 3b33c20)

Co-authored-by: Stanley <[email protected]>
miss-islington added a commit that referenced this pull request Oct 12, 2022
@miss-islington @slateny
Formatting fixes in contextlib docs (GH-98111)
59ddbc4
(cherry picked from commit 3b33c20)

Co-authored-by: Stanley <[email protected]>
miss-islington added a commit that referenced this pull request Oct 12, 2022
@miss-islington @slateny
Formatting fixes in contextlib docs (GH-98111)
f6abb33
(cherry picked from commit 3b33c20)

Co-authored-by: Stanley <[email protected]>
carljm added a commit to carljm/cpython that referenced this pull request Oct 14, 2022
@carljm
Merge branch 'main' into typewatch
6e53514
* main: (38 commits)
  pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259)
  Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399)
  bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596)
  pythongh-98178: syslog() is not thread-safe on macOS (python#98213)
  Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189)
  pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025)
  pythongh-96265: Formatting changes for faq/general (python#98129)
  tutorial: remove "with single quotes" (python#98204)
  pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214)
  signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217)
  pythongh-97669: Fix test_tools reference leak (python#98216)
  pythongh-97669: Create Tools/patchcheck/ directory (python#98186)
  pythongh-65046: Link to logging cookbook from asyncio docs (python#98207)
  Formatting fixes in contextlib docs (python#98111)
  pythongh-95276: Add callable entry to the glossary (python#95738)
  pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144)
  Fix some incorrect indentation around the main switch (python#98177)
  pythongh-98172: Fix formatting in `except*` docs (python#98173)
  pythongh-97982: Remove asciilib_count() (python#98164)
  pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181)
  ...
carljm added a commit to carljm/cpython that referenced this pull request Oct 14, 2022
@carljm
Merge branch 'main' into cached_property
0bb0c69
* main: (37 commits)
  pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259)
  Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399)
  bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596)
  pythongh-98178: syslog() is not thread-safe on macOS (python#98213)
  Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189)
  pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025)
  pythongh-96265: Formatting changes for faq/general (python#98129)
  tutorial: remove "with single quotes" (python#98204)
  pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214)
  signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217)
  pythongh-97669: Fix test_tools reference leak (python#98216)
  pythongh-97669: Create Tools/patchcheck/ directory (python#98186)
  pythongh-65046: Link to logging cookbook from asyncio docs (python#98207)
  Formatting fixes in contextlib docs (python#98111)
  pythongh-95276: Add callable entry to the glossary (python#95738)
  pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144)
  Fix some incorrect indentation around the main switch (python#98177)
  pythongh-98172: Fix formatting in `except*` docs (python#98173)
  pythongh-97982: Remove asciilib_count() (python#98164)
  pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181)
  ...
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
@miss-islington @slateny @pablogsal
Formatting fixes in contextlib docs (GH-98111)
61e24f3
(cherry picked from commit 3b33c20)

Co-authored-by: Stanley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@1st1 1st1 Awaiting requested review from 1st1

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@JelleZijlstra JelleZijlstra

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@slateny @miss-islington @bedevere-bot @JelleZijlstra
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.