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

bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs. by CharlieZhao95 · Pull Request #31349 · python/cpython · GitHub

/ cpython Public

bpo-46677: Add examples of inheritance and attributes to TypedDict docs. - #31349

Merged
JelleZijlstra merged 15 commits into
python:mainfrom
CharlieZhao95:bpo-46677/TypedDict
Mar 10, 2022
Merged

bpo-46677: Add examples of inheritance and attributes to TypedDict docs.#31349
JelleZijlstra merged 15 commits into
python:mainfrom
CharlieZhao95:bpo-46677/TypedDict

Conversation

CharlieZhao95 commented Feb 15, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Add examples of inheritance and attributes to TypedDict docs.

https://bugs.python.org/issue46677

97littleleaf11 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

I think it would be better to mention PEP655 in the doc!

JelleZijlstra self-requested a review February 15, 2022 14:57

JelleZijlstra 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

Thanks! Some high-level feedback:

  • It would be good to use the formal syntax for these attributes, as we do with ParamSpec.args (https://docs.python.org/3.10/library/typing.html#typing.ParamSpec.args). That way, we can refer to the attribute definitions by name and find them more easily.
  • This is going to conflict with #31126. We should probably merge that one first as it got here first :)
  • Could you also mention that the functional syntax is useful for TypedDicts with keys that aren't valid identifiers?
  • We can't mention PEP 655 yet because the PEP is still in draft. In the meantime, we should mention the mixed inheritance trick to make a TypedDict with some required and non-required keys.

And cc @davidfstr in case you'd also like to give some feedback here.

Comment thread Doc/library/typing.rst Outdated
JelleZijlstra self-assigned this Mar 9, 2022
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

JelleZijlstra 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

Thanks! @gvanrossum I'm planning to merge this docs enhancement for TypedDict.

JelleZijlstra merged commit 8a207e0 into python:main Mar 10, 2022

Copy link
Copy Markdown
Contributor

Thanks @CharlieZhao95 for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

Copy link
Copy Markdown
Contributor

Sorry @CharlieZhao95 and @JelleZijlstra, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 8a207e0321db75f3342692905e342f1d5e1add54 3.10

Copy link
Copy Markdown
Contributor

Sorry, @CharlieZhao95 and @JelleZijlstra, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 8a207e0321db75f3342692905e342f1d5e1add54 3.9

Copy link
Copy Markdown
Member

@CharlieZhao95 do you want to do the backports manually? Probably just need to fix some small conflicts.

AlexWaygood added needs backport to 3.10 only security fixes and removed needs backport to 3.10 only security fixes labels Mar 10, 2022

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Sorry @CharlieZhao95 and @JelleZijlstra, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 8a207e0321db75f3342692905e342f1d5e1add54 3.10

Copy link
Copy Markdown
Contributor Author

@CharlieZhao95 do you want to do the backports manually? Probably just need to fix some small conflicts.

Sure. It won't take long, I will finish it soon. 😉

CharlieZhao95 added a commit to CharlieZhao95/cpython that referenced this pull request Mar 11, 2022
…docs (pythonGH-31349)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0)

Copy link
Copy Markdown

GH-31808 is a backport of this pull request to the 3.9 branch.

CharlieZhao95 added a commit to CharlieZhao95/cpython that referenced this pull request Mar 11, 2022
…dDict` docs (pythonGH-31349)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0)

Co-authored-by: Charlie Zhao <68189100+CharlieZhao95@users.noreply.github.com>

Copy link
Copy Markdown

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

bedevere-bot removed the needs backport to 3.10 only security fixes label Mar 11, 2022
JelleZijlstra pushed a commit that referenced this pull request Mar 12, 2022
…dDict` docs (GH-31349) (GH-31815)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0)

Co-authored-by: Charlie Zhao <68189100+CharlieZhao95@users.noreply.github.com>
JelleZijlstra added a commit that referenced this pull request Mar 12, 2022
…Dict` docs. (GH-31349) (GH-31808)

* bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs (GH-31349)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0)
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…Dict` docs. (pythonGH-31349) (pythonGH-31808)

* bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs (pythonGH-31349)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0)
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.

10 participants


Back | FazBrowse Home | New Git URL