GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — bpo-42317: Improve docs of typing.get_args concerning Union by Dominik1123 · Pull Request #23254 · python/cpython Conversation
|
| For a typing object of the form ``X[Y, Z, ...]`` these functions return | ||
| ``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or | ||
| :mod:`collections` class, it gets normalized to the original class. | ||
| If ``X`` is a :class:`Union`, the order of ``(Y, Z, ...)`` may be different |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| If ``X`` is a :class:`Union`, the order of ``(Y, Z, ...)`` may be different | |
| If ``X`` is a :class:`Union` contained in another generic type, the order of ``(Y, Z, ...)`` may be different |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't really like the current proposed change because it's too broad, it may cause users to worry that all nested types are affected, when in reality it's only Union. Instead of:
Guido's change seems a lot more apt:
A quick search through the typing code tells me that only the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It's as broad as the promise of type caching goes, so I don't think it's too broad. But I agree that it's broader than necessary since indeed, at the moment, it requires a (Though I don't see why the two would be unequal; but that's a different concern)
So I just revert back to Guido's version? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Wow good catch, that looks like it may be a bug.
Maybe a combination of both yours and Guido's wording: Btw, thank you for the PR! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LG!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @Dominik1123 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-23254) (cherry picked from commit c3b9592) Co-authored-by: Dominik1123 <[email protected]>
|
GH-23307 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
(cherry picked from commit c3b9592) Co-authored-by: Dominik1123 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.